Learn how to install Ansible AWX on CentOS 7 with our step-by-step guide. Follow these instructions for a successful setup of the AWX web-based UI for Ansible automation. #centlinux #ansible #docker
Table of Contents
What is Ansible AWX?
Ansible AWX is an open-source web-based user interface for managing and visualizing Ansible automation. It provides a central platform for managing your Ansible playbooks, inventory, and credentials, offering features that streamline and enhance the automation process.
AWX is designed to make Ansible more usable for DevOps members of different technical proficiencies and skill sets. AWX is a hub for automation tasks. Ansible Tower is a commercial product supported by Red Hat, Inc. but derived from AWX upstream project, which is open source since September 2017. This makes AWX a good alternative of Ansible Tower.
Here are some key features and benefits of Ansible AWX:
Key Features
- Web-Based Interface: AWX provides a graphical interface to manage Ansible playbooks, schedules, and inventories, making it easier to handle automation tasks.
- Role-Based Access Control: It supports fine-grained access control, allowing administrators to define who can access different parts of the automation process.
- Job Scheduling: AWX enables you to schedule Ansible playbook runs, so you can automate tasks on a recurring basis.
- Inventory Management: You can manage dynamic and static inventories, making it easier to keep track of the systems and environments you’re managing.
- Project Management: AWX allows you to manage and organize your Ansible playbooks, roles, and collections as projects.
- Task Logging: It provides detailed logs and audit trails for all automation tasks, which helps with troubleshooting and tracking changes.
- Notifications: AWX supports notifications via various channels (e.g., email, Slack) to keep you informed about the status of automation tasks.
- API Support: AWX offers a RESTful API, allowing integration with other tools and custom applications.
Benefits
- Centralized Management: AWX centralizes management tasks, making it easier to oversee and coordinate automation efforts across different environments.
- Enhanced Usability: The web UI and visual tools make it more accessible for users who may not be familiar with the command line.
- Scalability: AWX is designed to handle large-scale automation tasks, making it suitable for both small teams and large enterprises.
How It Fits with Ansible
AWX is essentially the upstream project for Red Hat’s Ansible Tower, which is the commercial version of AWX with additional features and support. If you’re using Ansible for automation, AWX provides an easy-to-use interface and management capabilities that can complement your automation efforts.
Recommended Training for You: Ansible Advanced – Hands-On – DevOps
Problem Statement
Currently, stable version of AWX 7.0 has been released that requires a containerized environment to install and run. According to AWX Project Documentation, we can deploy AWX on following containerization platforms.
- OpenShift
- Kubernetes
- Docker-Compose
We are using Docker-Compose here, because it is relatively easy to setup and requires less hardware resources as compare to OpenShift and Kubernetes.
We have already install Ansible on CentOS 7. Now, we are installing AWX with Docker-Compose on the same Ansible control node.
Linux Server Specification
We are using three CentOS 7 virtual machines with following specifications.
- CPU – 3.4 Ghz (2 Cores)
- Memory – 4 GB
- Storage – 60 GB
- Hostname – ansible-01.centlinux.com
- IP Address – 192.168.116.201 /24
- Operating System – CentOS 7.6
Read Also: How to install Ansible Semaphore on CentOS 8
Install EPEL Yum Repository
Connect with ansible-01.centlinux.com by using ssh as root user.
AWX requires some packages that are available in EPEL (Extra Packages for Enterprise Linux) yum repository. Therefore, we are installing epel-release package by using yum command to enable EPEL.
# yum install -y epel-release
Install Ansible AWX Prerequisites
AWX requires some prerequisite software packages, all of these packages are available in standard and EPEL yum repositories.
Therefore, we are Installing all prerequisite packages using a single yum command.
# yum -y install git gcc gcc-c++ nodejs gettext device-mapper-persistent-data lvm2 bzip2 python-pip
Install Docker CE on CentOS 7
Install Docker CE yum repository from Docker official website.
# yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo Loaded plugins: fastestmirror adding repo from: https://download.docker.com/linux/centos/docker-ce.repo grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo repo saved to /etc/yum.repos.d/docker-ce.repo
Since the Docker CE yum repository has been added, we can now install Docker CE using yum command.
# yum install -y docker-ce
Enable and start Docker service.
# systemctl enable --now docker.service Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
Install Docker Compose on CentOS 7
PyPI (Python Package Index) is a software package repository of software written in Python. PyPA (Python Package Authority) recommend use of PyPI for installation of Python software packages.
Therefore, we are installing docker-compose using pip command.
# pip install docker-compose
Install Ansible AWX on CentOS 7
Use git command to download AWX project from GitHub.
# git clone --depth 50 https://github.com/ansible/awx.git Cloning into 'awx'... remote: Enumerating objects: 8850, done. remote: Counting objects: 100% (8850/8850), done. remote: Compressing objects: 100% (4428/4428), done. remote: Total 8850 (delta 5006), reused 6388 (delta 4234), pack-reused 0 Receiving objects: 100% (8850/8850), 11.30 MiB | 246.00 KiB/s, done. Resolving deltas: 100% (5006/5006), done.
Go to ~/awx/installer directory and set a custom admin_password for AWX and PostgreSQL in inventory file.
# cd awx/installer # sed -i 's|admin_password=.*|admin_password=Ahmer@1234|g' inventory
Generate a random key to use for encryption in inventory file.
# openssl rand -base64 30 ejv9P72oNvD4AtWLhOUTvpxfdIfKIid3skwuK+ES
Add the generated string as secret_key in inventory file.
# sed -i 's|secret_key=.*|secret_key=ejv9P72oNvD4AtWLhOUTvpxfdIfKIid3skwuK+ES|g' inventory
You can also customize many directives here, according to your requirements.
Verify the changes that we have made in inventory.
# grep -v '^#' inventory | grep -v '^
Install AWX by using ansible-playbook command.
# ansible-playbook -i inventory install.yml
Ansible uses docker-compose to create the required containers by AWX. It will take time, according to your server’s specs, therefore sit back and relax for a while.
After successful configuration of AWX and relevant containers. You can check the list of Docker processes to the running containers that are created by docker-compose for AWX.
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2c36037e1edf ansible/awx_task:7.0.0 "/tini -- /bin/sh -câ¦" 2 minutes ago Up 2 minutes 8052/tcp awx_task 4af8c2a57530 ansible/awx_web:7.0.0 "/tini -- /bin/sh -câ¦" 2 minutes ago Up 2 minutes 0.0.0.0:80->8052/tcp awx_web 5580f44da60a memcached:alpine "docker-entrypoint.sâ¦" 2 minutes ago Up 2 minutes 11211/tcp awx_memcached 341e0660e369 ansible/awx_rabbitmq:3.7.4 "docker-entrypoint.sâ¦" 2 minutes ago Up 2 minutes 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp awx_rabbitmq 6529a106ab89 postgres:10 "docker-entrypoint.sâ¦" 2 minutes ago Up 2 minutes 5432/tcp awx_postgres
Allow HTTP service in Linux firewall, because the port 80 is mapped to the AWX container and it is used to access AWX web console.
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
Open URL http://ansible01.centlinux.com in a web browser.
Login as Admin User.
We are reached at the dashboard of Ansible AWX.
If you want to improve your knowledge about Ansible, then you should refer to Ansible Documentation or get a copy of Ansible Quick Start Guide: Control and monitor infrastructures of any size, physical or virtual (PAID LINK) by Packt Publishing.
Final Thoughts
Installing Ansible AWX on CentOS 7 can significantly enhance your automation capabilities by providing a powerful web-based interface for managing your Ansible tasks. By following the steps outlined in this guide, you can set up a robust automation environment to streamline your IT operations.
If you need personalized assistance or have specific requirements for your AWX installation, I’m here to help! Check out my Fiverr gig: DevOps Engineer for professional support and tailored solutions for your Ansible and AWX needs.
Feel free to reach out if you have any questions or need further assistance. Happy automating!