Integration with Ansible Automation Platform (AAP)

AAP Overview

Red Hat Ansible Automation Platform allows for the configuration and management of systems at scale through simple IT automation. If unfamiliar with AAP, see the AAP Docs. In this section, we will discuss the need for AAP integration with 5G RAN deployments on OpenShift.

Augmenting OpenShift with Ansible Automation

As discussed in previous sections, we leverage RHACM and OpenShift to configure our clusters through custom resource definitions and policy based governance. These definitions define the desired state of the clusters, and upon deployment and beyond, OpenShift works to bring the clusters to compliance with our policies. This is known as a declarative model of configuration, and alongside GitOps and our ZTP workflow, allows for simplicity and flexibility when managing a large number clusters at scale.

Often times in our declarative configuration workflow, there comes a need to configure important non-declarative components of a system such as bare metal servers, network infrastructure, or legacy systems. In these cases, we can leverage Ansible Automation Platform to manage these components through automated imperative configuration. Utilizing hooks into Ansible, we can invoke Ansible Playbooks upon deployment of a cluster or at other significant moments in the lifecycle of clusters. This allows for efficient and automated management of both the declarative and non-declarative components of 5G infrastructure.

Introduction to the AAP Operator

The AAP operator provides us with the necessary components to host both Ansible collections (through the Automation Hub) to leverage Ansible’s diverse distribution platform and Ansible automation objects (through the Automation Controller) natively through OpenShift. The operator offers the custom resource definitions AutomationHub and AutomationController, whose functions are defined below.

Defining AAP Components

Automation Hub

The OpenShift AAP operator’s Automation Hub, defined by the custom resource definition AutomationHub, is a downstream version of Galaxy NG which allows for the hosting of Ansible collections on a private distribution server. Collections are a distribution format for Ansible objects including playbooks, roles, modules, and plugins. We store all necessary Ansible collections through an Automation Hub deployed on OpenShift, allowing all dependencies to be hosted and managed through our local cluster. We can upload collections, manage collections, and interact with the Automation Hub through API or through its web UI.

Automation Controller

The OpenShift AAP operator’s Automation Controller, defined by the custom resource definition AutomationController, deploys an Ansible Automation Controller (formerly Ansible Tower) in our OpenShift cluster. Downstream of the AWX Project in operator form, our deployed Automation Controller provides a user interface, REST API, and task engine for executing Ansible jobs. The Automation Controller’s functionality includes managing Ansible automation objects including projects, inventories, playbooks, roles, credentials, and job templates, as well as the responsibility of invoking and monitoring the execution of Ansible jobs.

At a high level, an Ansible job is a running instance of a job template, which contains a logical collection of Ansible playbooks in the form of a project, a list of managed hosts in the form of an inventory, and any extra variables we want to pass to the job.

Workflow Overview

Now that we are familiar with AAP in OpenShift and the necessary components for integration, let’s walk through an Ansible integration workflow.

General AAP Integration Workflow

At a high level, the steps to AAP integration with 5G RAN ZTP deployments are as follows, with the steps we will cover in bold:

  • Mirror AAP operator to disconnected registry (outside the scope of this lab, see the official docs for more info).

  • Install AAP operator, deploy AutomationHub and AutomationController (outside the scope of this lab, see the Hub Installation Docs, the Controller Installation Docs, and the CRD examples for AutomationHub and AutomationController).

  • Upload necessary Ansible collections to Automation Hub (outside the scope of this lab).

  • Configure Automation Controller with Ansible automation resources (outside the scope of this lab, see configured Ansible resources at https://automation-aap.apps.hub.5g-deployment.lab).

  • Install MultiClusterHub add-ons (outside the scope of this lab).

  • Deploy spoke clusters.

  • Deploy Application and supporting resources to craft an application hook into AAP.

  • Spoke cluster(s) reach state where the Application’s PlacementRule applies, Ansible job is triggered by the Application, Ansible job completes successfully.

This Lab’s AAP Integration Workflow

This section will overview our example AAP integration workflow in this lab. If unfamiliar with the general AAP integration workflow, see the above section.

In this lab, we will deploy a SNO cluster through the ZTP pipeline and await the completion of the SNO deployment, which will mark the SNO cluster with the ztp-done label. The ztp-done label will trigger an Ansible job that creates the namespace ztp-day2-automation within our deployed SNO cluster, and completes by adding an aap-done label to the cluster. As explained in the above section, AAP is pre-configured in our lab environment, so we will only cover the steps to craft our application-based automation and ensure our automation ran successfully. The integration steps in this lab are as follows:

  • Deploy SNO2 cluster via ZTP workflow.

  • Deploy OpenShift objects for application-based hook into AAP.

    • Create our custom AnsibleJob that executes a Ansible Controller job template.

    • Create Application and supporting resources for managing cluster automation.

  • Wait for the SNO2 deployment to complete.

  • Automation triggered upon deployment completion.

  • Confirm automation has completed successfully.

    • Examine Application via Web UI.

    • Check cluster labels.

    • Check ztp-day2-automation namespace exists on our deployed cluster.

Look out for these steps in action throughout our ZTP deployment as we move through the lab.

Our example automation involves creating a new namespace within a deployed cluster, but this task can be replaced by any series of imperative configuration steps a cluster may need.