ansible share image

Red Hat Ansible Automation Platform is an enterprise automation tool that simplifies IT orchestration, configuration management, and application deployment. With its ability to automate repetitive tasks, Ansible has become a cornerstone of many DevOps workflows.

In this article, we will explore the process of setting up a containerized Ansible Automation Platform solution on Red Hat Enterprise Linux (RHEL) 9.2, and discuss the benefits of employing such a setup.

Benefits of containerized Ansible Automation Platform

Reasons to consider using containerized Ansible Automation Platform include the following:

  • Installation experience: Traditionally, during installation, we had to define all nodes, access, permissions, and many more. However, with this solution, we can do it on a single host.
  • Portability: The capability to package Ansible Automation Platform as a container facilitates seamless deployment across various environments, ensuring consistent behavior and results.
  • Resource efficiency: Optimized resource utilization and quicker deployment of automation tasks by consuming fewer resources than traditional nodes.
  • Simplified management: Containerization simplifies the management and maintenance of Ansible Automation Platform, enabling streamlined updates and version control.

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • Red Hat Enterprise Linux 9.2 workstation with administrative privileges.
  • System/server with the following resources:
    • Storage: 30 GB
    • Memory: 16 GB RAM
    • CPU: 4 cores

Download the containerized bundle

The Ansible Automation Platform offers comprehensive support for multiple platforms and architectures. For this article, we will specifically download Platform 2.4-x86_64 (Figure 1). To  download the file, visit the Ansible Automation Platform product page

bundel download
Figure 1: Containerized setup bundle download.

After downloading, you will receive the .tar.gz compressed file. To extract this file, use the following command:

$ ls
ansible-automation-platform-containerized-setup-bundle-2.4-1-x86_64.tar.gz
 
$ tar xvzf  ansible-automation-platform-containerized-setup-bundle-2.4-1-x86_64.tar.gz

Set up the dependencies

Follow the steps below to set up the dependencies.

1. Check the hostname 

Check the currently available hostname using the hostname command.

$ hostname
localhost.localdomain

2. Install the ansible-core and dependencies

We are preparing to deploy all containers of the Ansible Automation Platform using Ansible. Therefore, we require the presence of ansible-core in the system, along with the git, wget, and rsync packages.

$ sudo dnf install -y ansible-core git wget rsync

3. Configure the inventory file for Ansible Automation Platform installation

Upon extracting the bundle, an inventory file is generated under ansible-automation-platform- containerized-setup-bundle-2.4/inventory location, containing parameters such as the hostname, passwords, and credentials for host the container registry. You can refer to the provided file to update your inventory configurations. 

You need to update the hostname and password of the Ansible controller, automation hub, Event-Driven Ansible, and PostgreSQL database using the following commands:

$ sed -i 's/fqdn_of_your_rhel_host/localhost.localdomain/g' inventory
$ sed -i 's/<set your own>/redhat/g' inventory

An additional feature introduced allows you to define the controller_licence_file in the inventory, which will be fetched during the automation controller installation and define the path of the bundle directory.

When all updates have been made, your file should look as shown below.

# This is the AAP installer inventory file
# Please consult the docs if you're unsure what to add
# For all optional variables please consult the included README.md

# This section is for your AAP Controller host(s)
# -------------------------------------------------
[automationcontroller]
localhost.localdomain ansible_connection=local

# This section is for your AAP Automation Hub host(s)
# -----------------------------------------------------
[automationhub]
localhost.localdomain ansible_connection=local

# This section is for your AAP EDA Controller host(s)
# -----------------------------------------------------
[automationeda]
localhost.localdomain ansible_connection=local

# This section is for the AAP database(s)
# -----------------------------------------
# Uncomment the lines below and amend appropriately if you want AAP to install and manage the postgres databases
# Leave commented out if you intend to use your own external database and just set appropriate _pg_hosts vars
# see mandatory sections under each AAP component
[database]
localhost.localdomain ansible_connection=local

[all:vars]

# Common variables needed for installation
# ----------------------------------------
postgresql_admin_username=postgres
postgresql_admin_password=redhat
# If using the online (non-bundled) installer, you need to set RHN registry credentials
#registry_username=RHN registry username
#registry_password=RHN registry password
# If using the bundled installer, you need to alter defaults by using:
bundle_install=true
bundle_dir=/home/user/Downloads/ansible-automation-platform-containerized-setup-bundle-2.4-1-x86_64/bundle/

# AAP Controller - mandatory
# --------------------------
controller_admin_password=redhat
controller_pg_host=localhost.localdomain
controller_pg_password=redhat

# AAP Controller - optional
# -------------------------
# To use the postinstall feature you need to set these variables
#controller_postinstall=true
#controller_license_file=<full path to your manifest .zip file>
#controller_postinstall_dir=<full path to your config-as-code directory>

# AAP Automation Hub - mandatory
# ------------------------------
hub_admin_password=redhat
hub_pg_host=localhost.localdomain
hub_pg_password=redhat

# AAP Automation Hub - optional
# -----------------------------

# AAP EDA Controller - mandatory
# ------------------------------
eda_admin_password=redhat
eda_pg_host=localhost.localdomain
eda_pg_password=redhat
controller_main_url=https://localhost.localdomain

# AAP EDA Controller - optional

We are installing the Ansible Automation Platform using the bundle method. If you prefer to install it from Red Hat container registries, then define the RHN credentials under [all:vars].

To access registry.redhat.io (RHN registry), visit the Registry Service Accounts page and create a service account. Then, add the credentials provided above.

Installation

The installation of the Ansible Automation Platform is straightforward. With the help of ansible-playbook, we can do the installation. Before that, we need to set the collection path in the system using the following command. The collection directory will be obtained after the bundle is extracted.

Using the provided example path, please specify your file location accordingly:

$ export ANSIBLE_COLLECTIONS_PATH=/home/user/ansible-automation-platform-containerized-setup-bundle-2.4-1-x86_64/collections

To initiate the installation of the containerized Ansible Automation Platform, use the following commands.

If the system has a set root password, please refer to this command:

$ ansible-playbook -i inventory ansible.containerized_installer.install  --extra-vars "ansible_sudo_pass=sudo_pass"

You can also define or pass other options as shown below:

$ ansible-playbook -i inventory ansible.containerized_installer.install <options>

After the successful deployment of Ansible Automation Platform, you will get the following logs in your terminal. (Please note this might take some time.)

TASK [Execute automation controller resource configuration]
skipping: [localhost.localdomain]

PLAY RECAP
localhost                  : ok=13   changed=0    unreachable=0    failed=0    skipped=19   rescued=0    ignored=0  
localhost.localdomain            : ok=248  changed=116  unreachable=0    failed=0    skipped=38   rescued=0    ignored=0 

To ensure all containers are functioning properly and running healthy, it is necessary to check using the Podman command, as shown below:

[test@localhost]$ podman ps
CONTAINER ID  IMAGE                                                                             COMMAND               CREATED            STATUS            PORTS       NAMES
3b0ba97b6cbc  registry.redhat.io/rhel8/postgresql-13:latest                                     run-postgresql        About an hour ago  Up About an hour              postgresql
30f5c72d2ef5  registry.redhat.io/rhel8/redis-6:latest                                           run-redis             About an hour ago  Up About an hour              redis
da5a6736a549  registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest       /usr/bin/receptor...  About an hour ago  Up About an hour              receptor
da09cb02cbc2  registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest         /usr/bin/launch_a...  About an hour ago  Up About an hour              automation-controller-rsyslog
5e375a3000ba  registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest         /usr/bin/launch_a...  About an hour ago  Up About an hour              automation-controller-task
8966d48c8da8  registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest         /usr/bin/launch_a...  About an hour ago  Up About an hour              automation-controller-web
fe8181a70e9d  registry.redhat.io/ansible-automation-platform-24/eda-controller-rhel8:latest     gunicorn --bind 1...  About an hour ago  Up About an hour              automation-eda-api
e68ed6ec96e2  registry.redhat.io/ansible-automation-platform-24/eda-controller-rhel8:latest     daphne -b 127.0.0...  About an hour ago  Up About an hour              automation-eda-daphne
21bdf58fda44  registry.redhat.io/ansible-automation-platform-24/eda-controller-ui-rhel8:latest  /bin/sh -c nginx ...  About an hour ago  Up About an hour              automation-eda-web
2e6891d447e6  registry.redhat.io/ansible-automation-platform-24/eda-controller-rhel8:latest     aap-eda-manage rq...  About an hour ago  Up 59 minutes                 automation-eda-worker-1
e765db6d582b  registry.redhat.io/ansible-automation-platform-24/eda-controller-rhel8:latest     aap-eda-manage rq...  About an hour ago  Up 59 minutes                 automation-eda-worker-2
40d558b35409  registry.redhat.io/ansible-automation-platform-24/hub-rhel8:latest                pulp-api              58 minutes ago     Up 54 minutes                 automation-hub-api
2ad8cd0bdb75  registry.redhat.io/ansible-automation-platform-24/hub-rhel8:latest                pulp-content          57 minutes ago     Up 54 minutes                 automation-hub-content
3a5549071322  registry.redhat.io/ansible-automation-platform-24/hub-web-rhel8:latest            nginx -g daemon o...  57 minutes ago     Up 54 minutes                 automation-hub-web
533c8d52a5be  registry.redhat.io/ansible-automation-platform-24/hub-rhel8:latest                pulp-worker           57 minutes ago     Up 52 minutes                 automation-hub-worker-1
58fb57560932  registry.redhat.io/ansible-automation-platform-24/hub-rhel8:latest                pulp-worker           57 minutes ago     Up 52 minutes                 automation-hub-worker-2

Verify installation of Ansible Automation Platform

After the installation, it is important to verify the running components within Ansible Automation Platform, such as the automation controller, automation hub, and the recently integrated Event-Driven Ansible dashboard.

Automation controller

The Ansible automation controller, shown in Figure 2, facilitates a methodical implementation of automation through the integration of Ansible Automation Platform. By establishing uniform procedures for deploying, initiating, delegating, and auditing automation processes, it empowers enterprises to embrace automation with assurance, simultaneously curtailing excess and discrepancies within their IT landscapes.

Visit https://your_RHEL_host:443.

automation controller
Figure 2: Automation controller dashboard.

Automation hub

The Ansible automation hub, shown in Figure 3, serves as a centralized repository for the exploration, acquisition, and administration of Ansible Content Collections. These collections consist of comprehensive sets of modules, plug-ins, roles, and related documentation from Red Hat and affiliated partners. A component of your Red Hat Ansible Automation Platform subscription, the Ansible Content Collections available in the automation hub significantly expedite the automation of new projects for teams.

Visit https://your_RHEL_host:444.

Automation Hub
Figure 3: Automation Hub dashboard.

Event-Driven Ansible

Utilizing an event-driven approach, Ansible is capable of handling events that encapsulate detailed insights regarding the prevailing conditions within the IT environment. It efficiently assesses the optimal course of action in response to these events and subsequently orchestrates automated measures to effectively manage or resolve the identified occurrences. The Event-Driven Ansible dashboard is shown in Figure 4.

Visit https://your_RHEL_host:445.

EDA
Figure 4: Event-Driven Ansible dashboard. 

Continue your automation journey with Ansible Automation Platform

Get started with Ansible Automation Platform by exploring interactive hands-on labs. Download Ansible Automation Platform at no cost and begin your automation journey.