How to install Ansible AWX on Debian 10

How to install Ansible AWX on Debian 10

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

AWX is a web-based application used to control Ansible. You can manage Ansible playbooks, checklists, confidential and scheduled jobs from the AWX web interface.

feature

  • Support multiple clouds, such as AWS, Azure and GCP
  • User activity tracking
  • Improve efficiency and safety
  • Role-based user access control and authentication
  • Job scheduling
  • Comprehensive notification

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

prerequisites

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

getting Started

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

apt-get update -y

After updating all packages, use the following command to install other required packages:

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

After all the packages are installed, 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. Therefore, you need to add the Ansible repository to APT. You can add it with the following command:

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

After adding the repository, use the following command to add the GPG key:

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

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

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

After installing Ansible, 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 has been 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 on your system. By default, the latest version of Docker is not available in the Debian 10 default repository. Therefore, you need to add the Docker CE repository to your system. First, add the Docker key and repository using 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 Docker CE using the following command:

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

After installing Docker, use the following command to verify the Docker version:

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 on your system. You can download the Docker Compose binary file using 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 -

After the download is complete, use the following command to set the appropriate permissions:

chmod +x docker-compose-Linux-x86_64

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

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

Next, use the following command to verify the Docker Compose version:

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 have been 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 the system. You can install Node.js and NPM with the following commands:

apt-get install nodejs npm -ynpm install npm --global

Next, install other Python dependencies using the following command:

apt-get install python3-pip git pwgen -y

Next, use the following command to install the Docker Compose module that matches your Docker Compose version:

pip3 install docker-compose==1.28.5

Once completed, you can proceed to the next step.

notes: Make sure that 1.28.5 matches the version of Docker Compose installed in the system.

Install AWX

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

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

After the download is complete, use the following command to decompress the downloaded file:

unzip 17.1.0.zip

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

cd awx-17.1.0/installer/

Next, generate the key by running the following command:

pwgen -N 1 -s 30

You should get the following output:

3BgGA8MnM4gKTXV8r7vQhwjjNixO6o

Next, edit the manifest file and define your administrator username, password, and key:

nano inventory

Change the following line:

admin_user=admin
admin_password=securepassword
secret_key=3BgGA8MnM4gKTXV8r7vQhwjjNixO6o

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

ansible-playbook -i inventory install.yml

After successfully installing AWX, you will 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 has been installed in your system. Now, you can continue to access the AWX Web UI.

Access Ansible AWX

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

Provide your administrator username and password, and click Log in Button. You should see the Ansible AWX dashboard in the following page:

Ansible AWX dashboard

in conclusion

Congratulations! You have successfully installed Ansible AWX on Debian 10 server. Now you can easily manage Ansible playbooks, inventory and jobs from the AWX dashboard. If you have any questions, please feel free to ask me.

Source

Related Posts