Installation Deployment ansible AWX on CentOS 8 - PandaM0nium/AWX GitHub Wiki

Step 1) Install EPEL on CentOS 8

Begin by installing EPEL on CentOS 8 node because it provides some of the quintessential packages required by AWX. Therefore, log in as root user to your CentOS 8 node and run the command:

[root@awx-ansible ~]# dnf install epel-release -y

Step 2) Install additional packages and dependencies

Additionally, we need to take an extra step and install essential packages that will be required as we get along with the installation of AWX:

[root@awx-ansible ~]# dnf install git gcc gcc-c++ nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip Sample Output

Install-packages-for-awx-centos8

Step 3) Install Docker CE on CentOS 8

RedHat / CentOS no longer supports the direct installation of docker, so if you run dnf install docker-ce, you are going to run into an error. To install docker on CentOS 8, we need to append the Docker repository to the system using the dnf config-manager tool.

[root@awx-ansible ~]# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo The next step is to install Docker, run the command:

[root@awx-ansible ~]# dnf install docker-ce-3:18.09.1-3.el7 Install-docker-ce-centos8 Now, run the following command to know what exact version of docker we have installed.

[root@awx-ansible ~]# rpm -qa | grep docker or [root@awx-ansible ~]# docker --version Now, proceed to start and enable docker using the commands

[root@awx-ansible ~]# systemctl start docker [root@awx-ansible ~]# systemctl enable --now docker.service With docker installed, we can now proceed to install Docker compose.

Note: Run the following command to set python command to use python 3 because in CentOS 8 and RHEL8, python 3 is installed as dependency when we install ansible

[root@awx-ansible ~]# alternatives --set python /usr/bin/python3

Step 4) Install Docker-Compose on CentOS 8

For the installation of docker-compose, we will use the pip command. Pip is python’s package manager that allows you to install python packages.

To install, we are going to use pip3 since the system is running using python3

[root@awx-ansible ~]# pip3 install docker-compose pip3-docker-compose-install Great! we can now proceed to install AWX.

Step 5) Install Ansible AWX

To install AWX, first clone the Git repo as shown:

[root@awx-ansible ~]# git clone https://github.com/ansible/awx.git Git-Clone-AWX-CentOS8 Next, navigate to the awx/installer directory and locate the inventory file. We need to adjust a few parameters:

Note: Don not forget to set the default python interpreter to python3

[root@awx-ansible ~]# cd awx/installer/ [root@awx-ansible installer]# vi inventory

localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3" postgres_data_dir=/var/lib/pgdocker awx_official=true project_data_dir=/var/lib/awx/projects awx_alternate_dns_servers="4.2.2.1,4.2.2.2" Equally crucial is the need to configure the Admin & Postgres password

pg_admin_password=postgrespass@123 admin_password=Linuxtechi@123 Thereafter, be sure to generate a cryptographic key for encryption of the inventory file

[root@awx-ansible ~]# openssl rand -base64 30 Secret-key-openssl-centos8 Copy the secret key and append it to the secret_key entry as follows in the inventory file,

secret_key=SGYsSWciI5yRDQeZuEm5wW98pQeJMG+ACABPsGfC Save and exit the inventory file.

To confirm and print out the changes made, run the command:

[root@awx-ansible installer]# grep -v '^#' inventory | grep -v '^$' Inventory-file-ansible-awx-centos8 To install AWX run the Ansible command:

[root@awx-ansible installer]# ansible-playbook -i inventory install.yml ansible-playbook-awx-1 This takes about 4-5 minutes for docker to run the necessary containers and build containers, so relax and enjoy your cup of tea! The output below will be a confirmation that all went perfectly well.

ansible-playbook-awx-2 After the installation is done, you can check the containers which are launched via docker-compose

[root@awx-ansible installer]# docker ps docker-containers-awx-centos8 In Case OS firewall is enabled and running, then allow the http port (80) and https (443) using following commands,

[root@awx-ansible installer]# firewall-cmd --zone=public --add-masquerade --permanent [root@awx-ansible installer]# firewall-cmd --permanent --add-service=http [root@awx-ansible installer]# firewall-cmd --permanent --add-service=https [root@awx-ansible installer]# firewall-cmd --reload Step 5) Accessing AWX GUI Portal To access AWX web console, open your browser and type in your Ansible’s AWX server IP and hit ENTER.

http://awx-server-ip-address

Ansible-AWX-Login-Page

Provide the username and password for Admin and hit ENTER. This will thereafter display AWX’s dashboard as shown:

Ansible-AWX-Dashboard-CentOS8

And that’s how you install AWX with docker-compose on a CentOS 8 server.