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.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Ansible AWX queries.
In this context, we shall look into how to set up Ansible AWX on ubuntu 20.04.
To begin with this procedure, you need to have a user account with sudo privileges.
Then follow the steps given below.
1. 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
2. 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
3. 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:
https://docs.docker.com/engine/install/ubuntu/
Use the following command to install docker-engine:
$ sudo apt install docker docker.io -y
Check docker version using the following command:
$ docker version
To install docker compose you can take the following link as reference.
https://linuxapt.com/blog/167-install-docker-compose-on-ubuntu-20-04
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 will display the installed docker-compose version.
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
Now change the directory to awx/installer as:
$ cd awx/installer
Generate a secret key using pwgen as :
$ pwgen -N 1 -s 30
This will generate a secret key.
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. This will take you to the UI of AWX.
You can manage hosts, inventories, and projects from the dashboard.
This article covers how to install ansible AWX on Ubuntu 20.04. You have got a basic idea about managing hosts, inventories, and projects from AWX ansible.
Ansible AWX is an open source tool which provides a web-based user interface, REST API, and task engine for easy and collaborative management of Ansible Playbooks and Inventories.
AWX allows you to centrally manage Ansible playbooks, inventories, Secrets, and scheduled jobs from a web interface.
To Install Ansible on Ubuntu:
Run the following commands,
# sudo apt update
# sudo apt install ansible