Installation on server

useradd ansible -m
yum upgrade
yum install ansible

--Add all hosts into groups in /etc/ansible/hosts

Installation on hosts

useradd ansible -m
yum install sudo
echo "ansible ALL=(root) NOPASSWD:    ALL" >> /etc/sudoers
Add pub key from ansible control server to ansible user authorized_keys.

Test all hosts

su - ansible
ansible vboxs -m ping
-- Update OS
ansible vboxs -m yum -a "name=* state=latest" -b


Build 8.2 on virtualbox (2cpu/4096mb +30gb disk)
If network is not on by default….set ONBOOT=yes in /etc/sysconfig/network-scripts/ifcfg-enp0s3

Create the following 2 scripts;

#!/usr/bin/env bash
sed -i '^SELINUX.*/SELINUX=disabled/' /etc/sysconfig/selinux
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https


#!/usr/bin/env bash
yum install -y centos-release-ansible-29
yum install -y ansible yum-utils git python3
yum-config-manager --add-repo
yum install -y docker-ce-3:18.09.1-3.el7
systemctl start docker ; systemctl enable docker
pip3 install docker ; pip3 install docker-compose
mkdir /var/lib/pgdocker /var/tmp/build
cd /var/tmp/build/
git clone -b 14.0.0
cd awx/installer
sed -i 's/^postgres_data_dir.*/postgres_data_dir="\/var\/lib\/pgdocker"/' /var/tmp/build/awx/installer/inventory

Now run the first script;

bash build1.bash

Once the server has come up run

bash build2.bash

Now run the following;

cd /var/tmp/build/awx/installer
ansible-playbook -i inventory install.yml

Open the url to your server http://servernameorip:80
Login using admin/password
NOTE: Once the containers are up, it can take a few minutes for various task completions. Therefore the page may take a while to load and inform you of upgrades in progress.

Upgrading AWX

It's important to keep the inventory file from the installation as this will contain changes from the default installation.
You can run a diff on the original inventory against the new inventory file.
Any changes to the default can be written to a file called vars.yml and placed in awx/installer/
Check the version you wish to upgrade to.

cd /var/tmp/build/
mv awx awx_old
git clone -b 14.0.0
cd awx/installer
[ copy your vars file to here ]
ansible-playbook -i inventory install.yml -e @vars.yml 

That's it! Sit back and wait.


If any errors appear from the ansible-playbook run, take a look at the awx_task container logs.

docker logs -f awx_task

If the logs show connection failures, try restarting all the containers;

docker restart $(docker ps -q)
  • automation/ansible.txt
  • Last modified: 2020/09/19 20:58
  • by preb