There is a new version of this tutorial available for Debian 11 (Bullseye).

How to Install Ansible AWX on Debian 10

Ansible is an open-source automation tool used for software provisioning, configuration management, and application deployment. It allows you to install, configure and deploy applications across multiple systems automatically.

AWX is a web-based application used for controlling Ansible. You can manage Ansible playbooks, inventories, Secrets, and scheduled jobs from an AWX web interface.

Features

  • Support multiple clouds such as AWS, Azure, and GCP
  • User Activity Tracking
  • Increase efficiency & security
  • Role-based access control of users & Authentication
  • Job scheduling
  • Integrated Notifications

In this post, we will show you how to install AWX on Debian 10 server.

Prerequisites

  • A server running Debian 10.
  • A root password is configured the server.

Getting Started

First, update all system packages to the latest version using the following command:

apt-get update -y

Once all the packages are updated, install other required packages with the following command:

apt-get install apt-transport-https ca-certificates software-properties-common unzip gnupg2 curl git -y

After installing all the packages, you can proceed to the next step.

Install Ansible

Next, you will need to install Ansible in your system. By default, the latest version of Ansible is not included in the Debian 10 repository. So you will need to add Ansible repository to APT. You can add it with the following command:

echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | tee /etc/apt/sources.list.d/ansible.list

Once the repository is added, add the GPG key with the following command:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367

Next, update the repository and install the latest version of Ansible with the following command:

apt-get update -y
apt-get install ansible -y

Once the Ansible is installed, you can verify the installed version of Ansible with the following command:

ansible --version

You should get the following output:

ansible 2.9.19
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]

At this point, Ansible is installed in your system. You can now proceed to the next step.

Install Docker and Docker Compose

Next, you will need to install Docker and Docker Compose to your system. By default, the latest version of Docker is not available in the Debian 10 default repository. So you will need to add the Docker CE repository to your system. First, add the Docker key and repository with the following command:

curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Next, update the repository and install the Docker CE with the following command:

apt-get update -y
apt-get install docker-ce -y

Once the Docker is installed, verify the Docker version with the following command:

docker --version

You should see the following output:

Docker version 20.10.5, build 55c4c88

Next, you will need to install the latest version of Docker Compose to your system. You can download the Docker Compose binary with the following command:

curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-Linux-x86_64 | cut -d '"' -f 4 | wget -qi -

Once the download is completed, set proper permission with the following command:

chmod +x docker-compose-Linux-x86_64

Next, move the Docker Compose binary to the system path with the following command:

mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

Next, verify the Docker Compose version with the following command:

docker-compose version

You should get the following output:

docker-compose version 1.28.5, build c4eb3a1f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

At this point, Docker and Docker Compose are installed in your system. You can now proceed to the next step.

Install Node.js and NPM

Next, you will need to install Node.js and NPM in your system. You can install Node.js and NPM with the following command:

apt-get install nodejs npm -y
npm install npm --global

Next, install other Python dependencies with the following command:

apt-get install python3-pip git pwgen -y

Next, install Docker Compose module that match your Docker Compose version with the following command:

pip3 install docker-compose==1.28.5

Once you are finished, you can proceed to the next step.

Note: Make sure 1.28.5 matches the Docker Compose version installed in your system.

Install AWX

Next, you will need to install AWX in your system. First, download the AWX from the Git Hub repository with the following command:

wget https://github.com/ansible/awx/archive/17.1.0.zip

Once the download is completed, unzip the downloaded file with the following command:

unzip 17.1.0.zip

Next, change the directory to installer with the following command:

cd awx-17.1.0/installer/

Next, generate the secrete key by running the following command:

pwgen -N 1 -s 30

You should get the following output:

3BgGA8MnM4gKTXV8r7vQhwjjNixO6o

Next, edit the inventory file and define your admin username, password and secrete key:

nano inventory

Change the following lines:

admin_user=admin
admin_password=securepassword
secret_key=3BgGA8MnM4gKTXV8r7vQhwjjNixO6o

Save and close the file when you are finished then install the AWX by running the following command:

ansible-playbook -i inventory install.yml

Once the AWX has been installed successfully, you should get the following output:

changed: [localhost]

TASK [local_docker : Create Docker Compose Configuration] *************************************************************************************
changed: [localhost] => (item={u'mode': u'0600', u'file': u'environment.sh'})
changed: [localhost] => (item={u'mode': u'0600', u'file': u'credentials.py'})
changed: [localhost] => (item={u'mode': u'0600', u'file': u'docker-compose.yml'})
changed: [localhost] => (item={u'mode': u'0600', u'file': u'nginx.conf'})
changed: [localhost] => (item={u'mode': u'0664', u'file': u'redis.conf'})

TASK [local_docker : Render SECRET_KEY file] **************************************************************************************************
changed: [localhost]

TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ********************
ok: [localhost]

TASK [local_docker : Run migrations in task container] ****************************************************************************************
changed: [localhost]

TASK [local_docker : Start the containers] ****************************************************************************************************
changed: [localhost]

TASK [local_docker : Update CA trust in awx_web container] ************************************************************************************
changed: [localhost]

TASK [local_docker : Update CA trust in awx_task container] ***********************************************************************************
changed: [localhost]

TASK [local_docker : Wait for launch script to create user] ***********************************************************************************
ok: [localhost]

TASK [local_docker : Create Preload data] *****************************************************************************************************
changed: [localhost]

PLAY RECAP ************************************************************************************************************************************
localhost                  : ok=21   changed=12   unreachable=0    failed=0    skipped=73   rescued=0    ignored=1   

At this point, AWX is installed in your system. You can now proceed to access the AWX web UI.

Access Ansible AWX

Now, open your web browser and access the Ansible AWX web interface using the URL http://your-server-ip. You will be redirected to the AWX login page:

Ansible AWX Login

Provide your admin username, password and click on the Log In button. You should see the Ansible AWX dashboard in the following page:

Ansible AWX dashboard

Conclusion

Congratulations! you have successfully installed Ansible AWX on Debian 10 server. You can now easily manage the Ansible playbook, inventory and jobs from the AWX dashboard. Feel free to ask me if you have any questions.

Share this page:

5 Comment(s)