How Do You Troubleshoot the Error “VpcLimitExceeded” When Running an Ansible Playbook in AWS?

Problem scenario
You are running an Ansible playbook in AWS, and you get this message:

TASK [metron-test:  Create virtual private cloud] ******************************
fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “VpcLimitExceeded: The maximum number of VPCs has been reached.”}
        to retry, use: –limit @/usr/bin/metron/metron-deployment/amazon-ec2/playbook.retry

Solution
You must have an AWS account with a special maximum of VPCs.

How Do You Fix The Ansible Error “Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013”?

Problem scenario
You are using Ansible, and you receive an error like this:

coolserver.com | UNREACHABLE! => {
    “changed”: false,
    “msg”: “Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\npercent_expand: unknown key %C\r\n”,
    “unreachable”: true

How do you fix this?

How Do You Get an Ansible Playbook to Change a Variable Based on a Conditional?

Problem scenario
You do not want to manipulate a variable using a shell: or command: key word. You want a variable to be changed based on conditional logic. What do you do?

Solution
Use “set_fact:” and “when:”

Here is an example:

set_fact:
vara: False
when: “{{ foobar }}” == 35 …

How Do You Install an Older Version of Ansible on an AWS Instance of Red Hat Linux?

Problem scenario
You are using Red Hat Enterprise Linux in AWS.  You need to install an older version of Ansible — not the newest.  The pip command and other supported ways of deploying Ansible automatically use the newest version.  You also want to install Maven. 

Solution
Run this script with “sudo”. (You could run it as root, but that is not recommended.)  The server must be in a Security Group with access to the internet.

What Do You Do If You Run an Ansible Command and You Receive an Error “Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e”?

Problem scenario
You run an Ansible command.  But you get an error like this:

” UNREACHABLE! => { “changed”: false, “msg”: “Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 1.0.1e
-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56:”

What should you do?

Solution
On the Ansible control server find the ansible.cfg file (find / -name ansible.cfg).  If you not using Mac OS, this stanza should not be in your ansible.cfg file:

[Sassy_Social_Share]

How Do You Install Ansible on an AWS Instance of RedHat Enterprise Linux?

Problem scenario
One of the following applies:
1. You want to install Ansible on an AWS instance of RHEL.  
2. You want to install Ansible on a GCP server running RHEL.

How do you do either of these things?

Solution
These directions should work for other RedHat distributions of Linux (e.g., Fedora or CentOS) that are not AWS servers as long as the server has 2 GB of RAM.

How Do You Install Ansible on an AWS Instance of Linux SUSE?

Problem scenario
You want to use Ansible with Linux SUSE.  How do you install Ansible (the control node) on an AWS Instance of Linux SUSE?

Solution
Prerequisite
You must have 2.5 GB of memory (either in RAM or with a combination of RAM and swap space). For directions on how to configure swap space in the amount of 2 GB,

Troubleshooting Ansible With Windows Managed Nodes

Problem scenario
When running various Ansible operations, such as “ping,” result in an error like this “SSL: 500 WinRM Transport. [Error 104] Connection reset by peer.”  What should you do to get Ansible to work with Windows managed nodes?

Solution

Prerequisites
Install pip. If you need assistance, see this posting.

Procedures
Upgrade pywinrm to 0.2.2. 

Ansible Documentation Appears To Have Errors

Ansible’s documentation (http://docs.ansible.com/ansible/intro_windows.html#inventory) indicates that inventory variables (in .yml files) are assigned with colons (“:”) and not equals (“=”) signs.  However in practice, equals (“=”) signs are necessary for key-value assignments and colons (“:”) do not work.  If you have found their documentation to be correct, please post a comment.

Ansible Can Push Down Files and/or Changes To New Servers With Little Initial Configuration

Some critics say that Ansible does not do enough to warrant its deployment in an enterprise.  The initial deployment to the managed nodes is less than what Puppet and Chef require.  Even minionless deployments of SaltStack require more configuration work than Ansible.  In this post, we want to demonstrate an advantage of adopting Ansible related to the first deployment.  When using passwordless SSH authentication, the great benefit is the lack of a prompt.