Archival Notice
This guide was written for CentOS 7 and legacy Docker-based deployments of Ansible AWX. Please note that the last release of this legacy AWX repository was on July 2, 2024. Releases of the project are now paused during a large-scale refactoring. For more information, follow the official Ansible Forum and see the various communications on the matter.
Ansible is an incredibly powerful automation tool, but managing playbooks, inventories, and credentials across a team via the CLI can become cumbersome. This is where Ansible AWX—the open-source upstream project for Red Hat Ansible Tower—comes in. AWX provides a web-based user interface, REST API, and task engine built on top of Ansible.
In this guide, I will walk you through the complete process of installing Ansible AWX using Docker on CentOS 7, resolving common dependency conflicts, configuring the installer inventory, and setting up client nodes for passwordless automation.
Prerequisites
Before starting, ensure you have a clean CentOS 7 VM or server with root access. We will be installing Docker CE, Ansible, and Docker Compose as part of the setup.
Step 1: System Update and SELinux Configuration
First, update the system packages and install required utilities. For AWX to function smoothly with Docker on CentOS 7, it is recommended to disable SELinux.
yum update -y
yum install epel-release.noarch yum-utils.noarch -y
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
Reboot the server to apply the SELinux changes:
reboot
Recommended Step
After rebooting, taking a VM snapshot is highly recommended so you can easily roll back if needed during the installation process.
Step 2: Firewall and Docker CE Installation
Once back online, open the HTTP service in the firewall so the AWX web interface will be accessible.
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-all
Next, add the official Docker CE repository and install Docker, Ansible, Git, and helpful monitoring utilities like htop, iftop, and atop.
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce ansible git bash-completion iftop htop atop -y
Start and enable the Docker service:
systemctl start docker
systemctl enable docker
systemctl status docker
source /etc/profile.d/bash_completion.sh
Step 3: Resolving Python and Docker-Py Dependencies
A common stumbling block when installing AWX on CentOS 7 is dependency conflicts between docker-py and docker Python packages. To ensure a clean environment, we will install pip and upgrade docker-compose while specifically avoiding the conflicting packages.
yum install python2-pip -y
pip install --upgrade pip
pip uninstall cryptography -y
pip install cryptography -y
pip install docker-compose
Dependency Conflict Warning
Do not install python-docker-py via yum, as it conflicts with the PyPI version required by Ansible's Docker modules.
Step 4: Download AWX Source Code and Logos
Clone the official AWX repository and the AWX logos repository into /root.
cd /root/
git clone https://github.com/ansible/awx.git
cd /root/awx/
git clone https://github.com/ansible/awx-logos.git
Step 5: Configure Installer Inventory
AWX is installed by running an Ansible playbook that deploys Docker containers. We need to modify the default inventory file to customize data directories, enable official logos, and specify DNS servers.
Run the following sed commands to update the inventory configuration:
# Change PostgreSQL data directory to /var/lib/pgdocker
sed -i 's+postgres_data_dir=/tmp/pgdocker+postgres_data_dir=/var/lib/pgdocker+g' /root/awx/installer/inventory
# Enable official AWX logos
sed -i '/awx_official=false/s/^#//g' /root/awx/installer/inventory
sed -i 's/awx_official=false/awx_official=true/g' /root/awx/installer/inventory
sed -i 's+ awx_official=true+awx_official=true+g' /root/awx/installer/inventory
# Set alternate DNS servers to Google Public DNS
sed -i '/awx_alternate_dns_servers=/s/^#//g' /root/awx/installer/inventory
sed -i 's+awx_alternate_dns_servers="10.1.2.3,10.2.3.4"+awx_alternate_dns_servers="8.8.8.8,8.8.4.4"+g' /root/awx/installer/inventory
# Enable project data directory
sed -i '/project_data_dir=/s/^#//g' /root/awx/installer/inventory
# Set Docker Compose directory to /var/lib/awx
sed -i 's+docker_compose_dir=/tmp/awxcompose+docker_compose_dir=/var/lib/awx+g' /root/awx/installer/inventory
To verify your changes, check the active configuration lines in the inventory file:
cat /root/awx/installer/inventory | egrep -v "#|^$"
Step 6: Run the Installation Playbook
Navigate to the installer directory and execute the install.yml playbook. This process pulls all required Docker images and spins up the AWX containers (Web UI, Task engine, PostgreSQL, Memcached, and RabbitMQ).
cd /root/awx/installer/
ansible-playbook -i inventory install.yml -vvvvvv
Deployment Duration
Depending on your internet download speed and server resources, this step will take around 5 to 10 minutes to complete. Once finished, you can access the AWX Web UI via your server's IP address.
Step 7: Setting Up Client Nodes for Automation
To actually manage target servers (clients) using AWX, we need to configure a dedicated ansible user on both the AWX server and the client machines with passwordless sudo access and SSH key authentication.
On Client Servers
Execute the following on each target machine you wish to manage:
useradd ansible
echo "Temp/123" | passwd --stdin ansible
echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible
On the AWX Server
Similarly, create the user on the AWX server and generate an SSH key pair:
useradd ansible
echo "Temp/123" | passwd --stdin ansible
echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible
su - ansible
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
Copy the public key to your client machines (replace omh-ansible-client1.induslevel.com with your actual client hostnames or IP addresses):
ssh-copy-id -i ~/.ssh/id_rsa.pub omh-ansible-client1.induslevel.com
ssh omh-ansible-client1.induslevel.com
exit
ssh-copy-id -i ~/.ssh/id_rsa.pub omh-ansible-client2.induslevel.com
ssh omh-ansible-client2.induslevel.com
exit
Step 8: Hardening Security (Removing Temporary Passwords)
Once SSH keys are successfully deployed, remove the temporary passwords from the ansible user on all machines to enforce key-only authentication.
On the AWX Server
su -
passwd -d ansible
On Client Machines (via SSH from AWX server)
su - ansible
ssh omh-ansible-client1.induslevel.com
sudo passwd -d ansible
exit
ssh omh-ansible-client2.induslevel.com
sudo passwd -d ansible
exit
Your Ansible AWX platform is now fully deployed and securely configured to manage your infrastructure!