Ansible AWX is an open-source project which is easy to use UI, Rest API and provides an easier way to manage your ansible project in IT environments. AWX facilitates you to centrally manage Ansible playbooks, inventories and secrets, and scheduled jobs using a web interface. Ansible AWX is an upstream project which is sponsored by Red hat from which the Red Hat Ansible Tower project is derived. In this article, you are going to learn how to set up Ansible AWX on ubuntu 20.04
- Ubuntu Server 20.04
- Proper internet connection to install packages
- A user account with sudo privileges.
- At Least 4GB Memory and 2 core CPU
Update Ubuntu System
Before installation of any packages, perform a system update to update repositories index to the latest.
$ sudo apt update -y
Use the following command to upgrade the Ubuntu system.
$ sudo apt upgrade -y
After updating and upgrading, run the following command to reboot the system.
$ sudo reboot now
Install Ansible on Ubuntu
Install extra packages python-setuptools and python3-pip to install the latest version of ansible using pip3 . Use the following command to install required python packages and dependencies.
$ sudo apt install python-setuptools -y
$ sudo apt install python3-pip -y
Now run the following command to install ansible using pip3.
$ sudo pip3 install ansible
After completing the installation, you can use ansible –version command to check the ansible version installed on your system.
$ ansible --version
You will get the following output:
The output shows that the installed ansible version is 2.10.6
Install docker and docker-compose
Ansible AWX runs as a container so you need to install docker to host container applications. You can install docker using some other ways on Ubuntu 20.04. For reference, you can take the following links.
Use the following command to install docker-engine.
$ sudo apt install docker docker.io -y
Check docker version using the following command:
$ docker version
You will have output similar as:
To install docker compose you can take the following link as reference.
To install docker-compose using pip3, run the following command:
$ sudo pip3 install docker-compose
To check docker-compose version run the command:
$ docker-compose version
The output shows that installed docker-compose version is 1.28.5
Now you need to give access to the docker group for currently logged-in users. Execute the following command in your terminal:
$ sudo usermod -aG docker $USER
You may need to install some extra packaged vim, git and pwgen. Execute the following command to install additional required packages:
$ sudo apt install git vim pwgen -y
Git -> Git client is used to pull source code and packages from git repositories.
Vim -> Vim is used as text editor
Pwgen – > pwgen is used to create random passwords.
Now you need to download Ansible AWX source code from github repository. Download source code/scripts to the local machine using the following command:
$ sudo git clone https://github.com/ansible/awx.git
You will get the output as:
Now change the directory to awx/installer as:
$ cd awx/installer
Generate a secret key using pwgen as :
$ pwgen -N 1 -s 30
You will have generated secret key similar as :
Now modify the inventory file with a text editor replacing admin_password and secret_key create before. Remember admin_password as it is needed to login in AWX web interface later.
$ sudo vi inventory
Save the file and exit.
Now implement yml playbook which downloads docker container images and sets them up accordingly. Run the following command to apply ansible playbook.
$ ansible-playbook -i inventory install.yml
The playbook pulls necessary AWX containers and runs as container service. Run the following command to find running AWX containers:
$ sudo docker ps -a
AWX web is running in port 80. Now you can navigate to your browser and type http://your-awx-server-ip to access AWX GUI.
Submit username as “admin” and admin_password you have set in inventory file. You will find UI of AWX as:
You can manage hosts, inventories, and projects from the dashboard.
In this article, you have learned how to install ansible AWX on Ubuntu 20.04. You have got a basic idea about managing hosts, inventories, and projects from AWX ansible.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.