The AWX Project (AWX) is an open source community project. In addition, it’s the OpenSource version of the Ansible Tower software sponsored by Red Hat, that enables users to better control their Ansible project use in IT environments.
In this tutorial, we will show you how to install and configure Ansible AWX on Docker on CentOS 8 Server.
System Requirements for Installing Ansible AWX Server
- 2GB of memory
- 2 cpu cores
- 20GB of space
Step 1./ Install required packages
01- First, we need to install the EPEL Repository as below:
$ dnf install epel-release -y
02- Second, we need to install some dpendencies packages like ansible:
$ dnf install git gcc gcc-c++ nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip ansible
Step 2./ Install Docker
01- To install Docker, first, we need to install the Docker repository, so use the following command:
$ dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
02- Next, use the below command to install docker-ce package:
$ dnf install docker-ce --nobest -y
03- Once the installation finished, let’s enable and start the Docker daemon:
# systemctl enable --now docker.service
Step 3./ Install Docker-compose tool
01- First, set python3 as the default one by running the below command:
$ alternatives --set python /usr/bin/python3
02- Next, use pip3
command to install the docker-compose tool:
$ pip3 install docker-compose
Step 4./ Install Ansible AWX
01- Now we can finally install Ansible AWX. Clone the latest release with the command:
$ git clone -b "17.1.0" https://github.com/ansible/awx.git
02- Next, generate a secret encryption key with the command:
$ openssl rand -base64 30 PblrUyeSvBMVWqHaaDMFcABcjzgG5dAhfeOgge4S
03- navigate to the awx/installer
directory and locate the inventory file. We need to adjust a few parameters:
$ cd awx/installer/ $ vi inventory
[all:vars] dockerhub_base=ansible awx_task_hostname=awx awx_web_hostname=awxweb postgres_data_dir="/myawx/pgdocker" host_port=80 host_port_ssl=443 docker_compose_dir="/myawx/awxcompose" pg_username=awx pg_password=awxpass pg_database=awx pg_port=5432 admin_user=admin admin_password=password create_preload_data=True secret_key=PblrUyeSvBMVWqHaaDMFcABcjzgG5dAhfeOgge4S awx_official=true project_data_dir=/myawx/projects
04- So, to install Ansible AWX run the Ansible command:
$ ansible-playbook -i inventory install.yml
05- After the installation is done, you can check the containers created by the docker-compose as below:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 05e67f321693 ansible/awx_task:11.2.0 "tini -- /bin/sh -c …" 10 seconds ago Up 7 seconds 8052/tcp awx_task 26cbdca749ae ansible/awx_web:11.2.0 "tini -- /bin/sh -c …" 12 seconds ago Up 9 seconds 0.0.0.0:80->8052/tcp awx_web ed03af85f7fa memcached:alpine "docker-entrypoint.s…" 17 seconds ago Up 11 seconds 11211/tcp awx_memcached 4140dad07ece redis "docker-entrypoint.s…" 17 seconds ago Up 11 seconds 6379/tcp awx_redis 5ccd44ed6285 postgres:10 "docker-entrypoint.s…" 17 seconds ago Up 12 seconds 5432/tcp awx_postgres
06- In Case that the firewalld is enabled and running, then use the below commands to allow the http port (80) and https (443):
$ sudo firewall-cmd --zone=public --add-masquerade --permanent $ sudo firewall-cmd --permanent --add-service=http $ sudo firewall-cmd --permanent --add-service=https $ sudo firewall-cmd --reload
07- If the Selinux enabled, use the below commands to Allow the Awx web server to access the network:
$ semanage port -a -t http_port_t -p tcp 8052 $ setsebool -P httpd_can_network_connect 1
Accessing Ansible AWX Web GUI
01- To access AWX web console, open your browser and type in your AAnsible’s AWX server IP: http://awx-server-ip-address
02- Finally, provide the username and password that been setup and you login to Ansible AWX dashboard:
Conclusion
You have successfully installed Ansible Awx on your CentOS 8 server. You might want to check the following guides :
10 comments
Great article, thanks 😊
Super notes, thanks for sharing. If anyone wants to know how to “configure SSL on Ansible AWX” using a self signed certificate then this should help you. This wasn’t documented propertly anywhere!
SSL on Ansible AWX
These steps worked seamlessly for us as of July 2020 version of AWX on Centos 8 server.
cd into the directory for your awx/inventory file
In my environment this was in /opt/awx/ so…
cd /opt/awx/installer
edit your “inventory” file and uncomment following 3 lines and add in the 4 line (change the directory path to the location where you will be storing your server.crt and server.key files)
host_port=80
host_port_ssl=443
ssl_certificate=/opt/awx/certs/server.crt
ssl_certificate_key=/opt/awx/certs/server.key
Run the following command to create your self-signed certificate.
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout server.key -out server.crt -subj "/C=GB/ST=UK/L=London/O=OrganisationName/OU=Product Engineering/CN=awx.local/[email protected]"
From the directory which contains your awx/installer/inventory file run the following to update your configuation
Then test your connection and hopefully SSL will now work for you! 🙂
Hope this helps you. If so please comment and let me know.
Sel
I dont understand this, Note: To persist the postgres data and the Ansible Awx, we already mounted partition to the directory /myawx. Can you provide us step by step OR the commands to execute to achieve this
Hi, we created a mount point volume dedidcated to awx directories
$ cd awx/installer doesn’t exist
use the below command to clone the repo
How to do stop and start the docker service with docker compose? or do you just do ‘docker stop awx_web’ for each of the containers, and then when you want to start them you run the install command again?
Hi,
you can use
docker-compose
start/stop or up/down the stackHi
Please be patient with me, as I am a newbie to linux and ansible.. I have followed the instructions above, however when I point a browser to my internal ip address “https:172.*.*.**” … I just get the nginx default page.. please can you advise on how to get the Ansible-awx interface up please.
Sorry if this is such a novice question 🙁
Hi anthony, the default port for the awx web interface is 80, accessible via http, maybe you have another app running in port 80