Introduction

The Ansible Automation Platform (AAP) Operator provides a cloud-native way to deploy and manage AAP on Red Hat OpenShift Container Platform (OCP) 4.9+. The operator handles the full lifecycle — installation, upgrades, backups, and restores — for both the Automation Controller and Automation Hub.

Prerequisites

  • Red Hat OpenShift Container Platform 4.9 or later
  • Cluster admin access
  • Red Hat subscription (or 60-day trial)
  • Minimum resources: 4 vCPU, 16 GB RAM for the Controller

Step 1: Install the AAP Operator

Via OperatorHub (Web Console)

  1. Log in to the OpenShift web console
  2. Navigate to Operators → OperatorHub
  3. Search for "Ansible Automation Platform"
  4. Click Install

Ansible Automation Platform Operator

Operator Configuration

ParameterDescriptionRecommendation
Update ChannelAAP version to installLatest stable (e.g., stable-2.4)
Installation ModeCluster-wide or namespaceAll namespaces for production
Installed NamespaceTarget namespaceDefault: aap
Update ApprovalManual or automaticManual for production

AAP operator installation parameters

Via CLI

# Create namespace
oc new-project aap

# Create OperatorGroup
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: aap-operator-group
  namespace: aap
spec:
  targetNamespaces:
    - aap
EOF

# Create Subscription
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: ansible-automation-platform
  namespace: aap
spec:
  channel: stable-2.4
  name: ansible-automation-platform-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  installPlanApproval: Manual
EOF

# Approve install plan
oc get installplan -n aap
oc patch installplan <plan-name> -n aap \
  --type merge -p '{"spec":{"approved":true}}'

Verify the operator is running:

oc get pods -n aap
# NAME                                                READY   STATUS
# aap-operator-controller-manager-xxxxx               2/2     Running

AAP operator installed

Step 2: Deploy Automation Controller

apiVersion: automationcontroller.ansible.com/v1beta1
kind: AutomationController
metadata:
  name: my-controller
  namespace: aap
spec:
  replicas: 1
  admin_user: admin
  admin_password_secret: controller-admin-password
  postgres_configuration_secret: controller-postgres-config
  route_tls_termination_mechanism: Edge
  garbage_collect_secrets: true

Create the admin password secret:

oc create secret generic controller-admin-password \
  -n aap \
  --from-literal=password='YourSecurePassword!'

Apply the Controller CR:

oc apply -f controller.yml
# Wait for deployment (5-10 minutes)
oc get automationcontroller -n aap -w

Step 3: Deploy Automation Hub

apiVersion: automationhub.ansible.com/v1beta1
kind: AutomationHub
metadata:
  name: my-hub
  namespace: aap
spec:
  replicas: 1
  route_tls_termination_mechanism: Edge
  storage_type: file
  file_storage_size: 50Gi
  file_storage_access_mode: ReadWriteOnce
oc apply -f hub.yml
oc get automationhub -n aap -w

Step 4: Access the Dashboard

# Get the Controller route
oc get route -n aap
# NAME            HOST/PORT
# my-controller   my-controller-aap.apps.cluster.example.com

Navigate to https://my-controller-aap.apps.cluster.example.com and log in with admin credentials.

AAP operator dashboard

Operator Custom Resources

The AAP Operator manages these resource types:

ResourcePurpose
AutomationControllerDeploy Controller instance
AutomationControllerBackupBack up Controller (jobs, inventories, credentials)
AutomationControllerRestoreRestore from backup
AutomationHubDeploy Hub instance
AutomationHubBackupBack up Hub (collections, secrets, DB)
AutomationHubRestoreRestore Hub from backup

Backup Example

apiVersion: automationcontroller.ansible.com/v1beta1
kind: AutomationControllerBackup
metadata:
  name: controller-backup-2024-01
  namespace: aap
spec:
  deployment_name: my-controller
  backup_pvc: controller-backup-pvc
  backup_pvc_namespace: aap

Restore Example

apiVersion: automationcontroller.ansible.com/v1beta1
kind: AutomationControllerRestore
metadata:
  name: controller-restore
  namespace: aap
spec:
  deployment_name: my-controller-restored
  backup_name: controller-backup-2024-01

Upgrading AAP on OpenShift

  1. Update the operator subscription channel:
    oc patch subscription ansible-automation-platform -n aap \
      --type merge -p '{"spec":{"channel":"stable-2.5"}}'
    
  2. Approve the new install plan (if manual approval)
  3. The operator automatically upgrades Controller and Hub instances

Troubleshooting

Pods Not Starting

# Check operator logs
oc logs -n aap deployment/aap-operator-controller-manager -c manager

# Check Controller pod events
oc describe pod -n aap -l app.kubernetes.io/name=my-controller

Database Connection Issues

# Verify PostgreSQL pod is running
oc get pods -n aap -l app.kubernetes.io/component=database

# Check DB secrets
oc get secret controller-postgres-config -n aap -o yaml

Insufficient Resources

The Controller needs at least 4 vCPU and 16 GB RAM. Check node resources:

oc describe nodes | grep -A5 "Allocated resources"

Conclusion

The AAP Operator is the recommended way to deploy Ansible Automation Platform on OpenShift. It handles the complete lifecycle — from initial deployment through upgrades and backup/restore — using Kubernetes-native custom resources. Start by installing the operator from OperatorHub, then create AutomationController and AutomationHub resources to get your enterprise automation platform running in minutes.

For a production-focused walkthrough, see Luca Berton's guide on automating Kubernetes with Ansible.