Docker Compose Awx

2/12/2022by admin

Ansible AWX is an upstream project of Ansible Tower. To evaluate ansible Tower, you can deploy AWX and check the functionality. AWX deployment is simple if you have an existing docker environment. AWX is an opensource project and the community is offering AWX in the form of container. AWX requires multiple components like a database, Message queue, web services etc. While deploying AWX, the following images will be installed on docker environment.

  1. Docker Compose Aws Secrets Manager
  2. Docker Compose Awx Tutorial
  3. Docker Compose Awx Command

Docker Compose Aws Secrets Manager

AWX Components:

  • postgres – Database
  • rabbitmq – Message Queue
  • memcached – General-Purpose Distributed Memory Caching system
  • awx_web – This image should be deployed together with ansible/awx_task
  • awx_task – This image should be deployed together with ansible/awx_web

Jul 29, 2020 The concept of Groups and Hosts. Note that inventories are divided into groups and hosts. A group might represent a particular environment (e.g. “Datacenter 1” or “Testing Bed”), a server type (e.g. “Web Servers” or “DB Servers”), or any other representation of your environment. AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. My Vagrantfile installs Docker and Ansible AWX during vagrant up, but I’ve included the steps below for reference. Installing Docker. Before installing Ansible AWX, Docker needs to be installed. Use the script below to install the Extra Packages Repo.

Ansible AWX project members ensured that deploying AWX should be very simple like automating other IT deployments. Here are the steps to deploy AWX on Docker environment.

  • Run the AWX deployment playbook.

Environment:

  • CentOS 7
  • SELinux Disabled
  • Firewall Disabled.
  • Internet connection

Deploying AWX :

1. Login to CentOS 7 server where you would like to host AWX.

2. Perform the docker test to ensure docker is functional and verify that system has internet access to pull the required images.

3. Cloning the AWX repo to your server.

4. Navigate to “awx” directory.

5. Navigate to installer directory.

6. Update the “inventory” file like below.

If you do not specify “project_data_dir=/var/lib/awx/projects” during the deployment, you can’t use Manual SCM. You might face issue while creating the new project.

“WARNING: There are no available playbook directories in /var/lib/awx/projects. Either that directory is empty, or all of the contents are already assigned to other projects. Create a new directory there and make sure the playbook files can be read by the “awx” system user, or have Tower directly retrieve your playbooks from source control using the SCM Type option above.”

Note: “postgres_data_dir” path also very important where the Postgres data will be stored. By default, it has been set to /tmp. In some cases /tmp will be cleaned up across the system reboot.

7. Run the ansible playbook to deploy AWX.

Docker

8. Look for the new docker instances. We could see that playbook has deployed 5 docker images for AWX.

9. Open the browser and access the server IP. Here, my host IP is ‘192.168.3.151’

AWX – Home Page

10. Login with AWX’s default credential ( admin/ password )

We have successfully deployed AWX. What’s Next? Start creating the playbook and integrate with AWX to start automating the environment.

Hope this article is informative to you. Share it! Comment it!! Be Sociable!!!

Scenario

After installing Ansible to test within a Windows environment,I wanted to explore other methods of administering and using Ansible other than from the commandline.

Solution

Although there was a commercial product called Ansible Tower availablefor testing, I wanted to explore the upstream project called AWX instead, as this had no licensing restrictions orlimits on how many nodes it could manage.

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible.

My Vagrantfile installs Dockerand Ansible AWX during vagrant up, but I’ve included the steps below for reference.

Docker Compose Awx Tutorial

Installing Docker

Before installing Ansible AWX, Docker needs to be installed.

Use the script below to install the Extra Packages Repo and other useful utils if required:

Run the install_docker_ce.sh script below to install Docker CE:

Installing Ansible AWX

Run the install_ansible_awx.sh script below to install Ansible AWX:

Part of the install_ansible_awx.sh above copies an Inventory file used to configure Docker, Postgres, RabbitMQ,and AWX. My configuration is shown below:

Build Verification

Once the Vagrant build has finished, you can check the progress of the final import / migration tasks withinDocker by following the steps below:

  1. From within the cloned repo folder (eg ~CodeAnsible-Windows), connect to the Ansible Control VM by running:
  2. List running containers:
  3. Tail the logs for the awx_task container:
  4. Once migrations are complete you will see messages like those shown below (amongst the many DEBUG messages):
Docker compose aws ecrDocker

On my dev laptop it took ~20 mins for Ansible Control VM provisioning and build of Docker / Ansible AWX.

Docker Compose Awx

Installation Error

Docker Compose Awx Command

During initial testing, my Ansible AWX installation failed with this error:

I had initially included docker-python and docker-compose in the installation scripts, so I removed these lines:

I then added the Docker SDK for Python via PIP using:

Docker-compose

What’s Next?

Check out my next blog post where I go over the steps fortesting Ansible AWX with Windows hosts.

Comments are closed.