Ansible administration is most often done from the command line. Make that task a bit more efficient with the help of the web-based GUI, AWX.
If you're an Ansible admin, you're probably well-versed in the ways of the command line interface (CLI). But there may be times when you long to have a nice GUI to make your admin job a bit easier.
That's where Ansible Web eXecutable (AWX) comes into play. AWX is a free/open source project that allows you to more easily manage your Ansible projects. AWX provides:
A web-based interface
Tax engine built on top of Ansible
A powerful REST API
The ability to manage or sync inventory with other cloud services
The ability to control access
Integration with LDAP
I'm going to show you how to install this powerful web GUI on CentOS 8.
SEE: How to become a network administrator: A cheat sheet (TechRepublic)
What you'll need
A running/updated instance of CentOS 8
A user with sudo privileges
How to install the AWX dependencies
The first thing to take care of is the installation of the dependencies. Log in to your CentOS 8 server, open a terminal window, and issue the following commands:
sudo dnf install epel-release -y sudo dnf install git gcc gcc-c++ ansible nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip -y
How to install Docker and Docker Compose
We now need to install both Docker and Docker Compose. The first thing to do is add the necessary repository with the command:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Once the repository is added, install the latest version of Docker with the command:
sudo dnf install docker-ce-3:18.09.1-3.el7 -y
Start and enable the Docker engine with the commands:
sudo systemctl start docker sudo systemctl enable docker
Add your user to the docker group with the command:
sudo usermod -aG docker $USER
Log out and log back in.
Install docker-compose via pip3 with the command:
sudo pip3 install docker-compose
Finally, set python to use Python 3 with the command:
alternatives --set python /usr/bin/python3
How to install AWX
Now we can finally install AWX. Clone the latest release with the command:
git clone https://github.com/ansible/awx.git
Next, generate a secret encryption key with the command:
openssl rand -base64 30
Copy the key that is generated to your clipboard.
Change into the newly downloaded AWX directory with the command:
Open the AWX inventory file with the command:
In that file, you'll need to (at a minimum), edit the following configuration options. First, locate the line:
In that line, paste the secret key you generated earlier.
Next, look for the line:
Change the password to a strong, unique password.
Finally, look for the line that starts with:
Change that line to:
You can then go through the rest of the inventory file and edit as needed. But, the above changes should result in a successful installation.
Create a directory for Postgres with the command:
sudo mkdir /var/lib/pgdocker
Install AWX with the command:
sudo ansible-playbook -i inventory install.yml
This should take about five to10 minutes to complete.
How to modify SELinux and the CentOS firewall
Before we can access the AWX site, we need to disable SELinux. Issue the command:
sudo nano /etc/sysconfig/selinux
Change the line:
Save and close the file. Restart your system so the changes will take effect.
The last step is to modify the firewall. This is done with the following commands:
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
Finally, open a web browser and point it to http://SERVER_IP (where SERVER_IP is the IP address of your hosting server). You will be greeted by the AWX login screen, where you'll use the admin username and the password you set in the admin_password configuration (Figure A).
Once you authenticate, you'll find yourself in the AWX dashboard, where you can begin working with Ansible through this user-friendly web-based GUI (Figure B).
Congratulations, working with Ansible should now be a bit easier.
- How to become a database administrator: A cheat sheet (TechRepublic)
- 10 things companies are keeping in their own data centers (TechRepublic download)
- Hiring kit: Database administrator (TechRepublic Premium)
- How hyperscale data centers are reshaping all of IT (ZDNet)
- Best cloud services for small businesses (CNET)
- DevOps: More must-read coverage (TechRepublic on Flipboard)