How to install AWX Ansible on CentOS/RedHat 7/8

This tutorial shows awx ansible installation on CentOS/RedHat 7/8. AWX is an open-source community project sponsored by Red HatAnsible Tower is a web-based solution that makes Ansible even more easy to use for IT teams of all kinds. It’s designed to be the hub for all of your automation tasks. AWX provides a web-based user interface. This tutorial you will learn How to install ansible awx on CentOS 7 steps by steps CentOS/RHEL 7/8.

You can also visity the below topics.

Ansible Tutorial
What is Ansible Configuration Files Explained with Examples
Ansible Lab Setup

Prerequisites

To follow this post to awx ansible installation, you will need one Linux server installed with CentOS/RHEL 7/8, must have root user privileges.

Configure SELinux

By default, SELinux is enforcing in CentOS/RHEL 7/8. We need to change SELINUX=enforcing to SELINUX=disabled. Edit the SELinux file and replace the “enforcing” with “disabled”.

Edit the SELinux file.

  • # vi /etc/sysconfig/selinux

Replace the “enforcing” with “disabled”

  • # SELINUX=disabled

Save and exit form /etc/sysconfig/selinux file. Reboot the your Linux server  with “reboot” command to apply the changes. once server come online check the status with below command and make sure it should disabled.

awx ansible installation

Enable EPEL Repository

Now You will need to install the packages for (EPEL) repository on your RedHat/CentOS 7/8 server for awx ansible installation.

Run the below commands on your server to install the packages for enterprise Linux (EPEL) repository.

  • # yum -y update
  • # yum -y install epel-release
  • # reboot

Install Required Packages

Run the below commands to install the required Packages.

  • # yum -y install git gcc gcc-c++ ansible nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip nano wget

Install Docker

Use the below command to enable Docker repository.

  • # wget https://download.docker.com/linux/centos/docker-ce.repo –directory-prefix /etc/yum.repos.d/

Type the below command to install Docker and start the Docker service and make it enable.

  • # yum -y install docker-ce
  • # systemctl start docker
  • # systemctl enable docker

Check the docker service is active and running or not.

  • # systemctl status docker
awx ansible installation

Run the below command to install Docker Compose.

  • # pip3 install docker-compose

Run the below command to install Docker Compose.

# pip3 install docker-compose

Now You can download Ansible AWX from the Git Hub repository using the below command.

  • # git clone -b 17.1.0 https://github.com/ansible/awx.git

Once download completed, run the below command to generate a secret key using openssl command and that key will be used to encrypt inventory file.

  • # openssl rand -base64 30
    • Below is secret key
    • M3S2wcdCuCugkkzJP38pj1S1SWV4l+Fr/doIZ5eG

Go to ~/awx/installer directory and set a custom admin_password for AWX and PostgreSQL in inventory file and add secret key.

  • # vi ~/awx/installer/inventory

Below are the list which one you need to add in inventory file.

postgres_data_dir=”/var/lib/awx/pgdocker”
docker_compose_dir=”/var/lib/awx/awxcompose”

pg_username=awx
pg_password=Password@123
pg_database=postgres
admin_user=admin
admin_password=Password@123

secret_key=rVVKN3T9BaLffFhS4/kx8q6nyTiK660L28+yt0px

awx_alternate_dns_servers=”8.8.8.8,8.8.4.4″

project_data_dir=/var/lib/awx/projects

Install AWX by using ansible-playbook command:

Go to ~/awx/installer directory and run the below commands.

  • # ansible-playbook -i ~/awx/installer/inventory ~/awx/installer/install.yml

Once you run the playbook then You can verify the running containers with the below command.

  • # docker ps

Add Firewall Rules

  • # firewall-cmd – -zone=public – -add-masquerade – -permanent
  • # firewall-cmd – -permanent – -add-service=http
  • # firewall-cmd – -permanent – -add-service=https
  • # firewall-cmd – -reload

Access AWX Web Interface
Open the web browser and type the http://your-server-ip in the address bar, you will be get the AWX login page.

Login Page 

4 thoughts on “How to install AWX Ansible on CentOS/RedHat 7/8

  1. In it something is. I agree with you, thanks for an explanation. As always all ingenious is simple.
    Thanks for an explanation, I too consider, that the easier, the better …
    I join told all above. We can communicate on this theme. Here or in PM.
    Where here against authority
    It is remarkable, very valuable phrase

    https://amic.co.in/catalog/font/

  2. AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. Please note that these instructions are applicable for AWX version 17.x only. We have also created a quick video tutorial to avoid any confusion while performing these installation steps.

Leave a Reply

Your email address will not be published.