Installation and configuration of the Ansible AWX product, the open-source version of the RedHat Enterprise Ansible Tower product.
Background
This post is a simple explanation of how to install and configure the Ansible AWX platform on a VirtualBox VM. The Ansible AWX software is installed and configured to run on a sequence of Docker containers running on a CentOS 7 VM.
Technology Ecosystem
There is 1 host for this tutorial. As a warning, make sure you follow the specs for the host as minimum requirements. If you do not allocate at least 4GB of memory and 2x vCPUs, your AWX web UI will likely be quite laggy and un-usable. Additionally, at the time of this post, you will need to use a CentOS 7 instance in order for this project to be successful.
Ansible AWX VM
- Hostname: awx.localhost
- OS: CentOS 7
- CPU: 2
- RAM: 4096MB
- Disk: 20GB
- Network: Private Network
- IP: 10.11.13.15
In addition, we will assume the following software versions:
- Ansible AWX: ‘devel’ branch
- Docker: 17.09.0-ce, build afdb6d4
Prerequisites
First, perform the prerequisite installations:
Next, install the Docker service and verify the Docker service is running as expected:
Installing AWX
Next, we will actually install and configure AWX using Docker containers via the installer.
At this point, the installer will use Ansible locally to kick off Docker containers and configure
the AWX service. To verify that AWS and its dependencies were installed into Docker containers, use
the Docker ps
command to verify there are 5 containers having names corresponding to each of the
required services.
At this point, your installer is likely complete locally, but there is database bootstrapping occurring. You can watch the database output progress by running the following docker command. Note that it takes several minutes for any progress to appear to be made, as well as several minutes in general to get to the point of finishing.
Once the above is complete, you can visit the AWX interface via navigating to the following URL in your browser (again, assuming the IP address of the VM this software was installed on is 10.11.13.15):
http://10.11.13.15/
The default login username is ‘admin’, and corresponding password is ‘password’.
Stopping/Starting AWX
There isn’t great documentation on how to stop/start the AWX instances other than brute-force stopping/starting the Docker service. In addition, I did run into an issue where one of my containers was lost/shut down by accident. In this case, it’s best to leverage the idempotency of the Ansible framework and re-use the installer to re-create any missing Docker containers for you. More specifically, if you lose any of your containers, re-run the installer command:
As the playbook is run, you’ll notice a lot of “no changes” type of activity, but it should output changes corresponding to the start of any missing containers. At the end of the run, you should be up and going again.
Also, if you restart your VM at all and don’t have Docker configured to start at boot, simply start the Docker service once the VM has booted and your AWX containers should come back up nicely (again, if not, just re-run the installer command above).
Troubleshooting
After installing I did run into an issue when attempting to configure SSH keys and run jobs on remote hosts from the Ansible AWX instance. The specific bug I encountered is documented here. To work around this issue, I followed the recommended course of action in the issue, but to be explicit, the following are the steps I took.
The error message I received when attempting to run jobs on remote hosts was the following:
fatal: Unreachable! => failed to connect to the host via ssh: Control Socket Connect:
Connect Refused. Failed to connect to new control master.
To correct the issue, you need to connect to the Docker container labeled “ansible/aws_task:latest”
and update the ansible.cfg
file to include a ControlPath specification.
For good measure, I restarted the containers using the Docker service restart command:
Following the restart, I was able to successfully run commands on remote instances.
Credit
The above tutorial was pieced together with some information from the following sites/resources: