Chapter 4. Installing Red Hat Ansible Automation Platform Operator from the OpenShift Container Platform CLI
Chapter 4. Installing Red Hat Ansible Automation Platform Operator from the OpenShift Container Platform CLI Use these instructions to install the Ansible Automation Platform Operator on Red Hat OpenShift Container Platform from the OpenShift Container Platform command-line interface (CLI) using the oc command. 4.1. Prerequisites Access to Red Hat OpenShift Container Platform using an account with operator installation permissions. The OpenShift Container Platform CLI oc command is installed on your local system. Refer to Installing the OpenShift CLI in the Red Hat OpenShift Container Platform product documentation for further information. 4.2. Subscribing a namespace to an operator using the OpenShift Container Platform CLI Use this procedure to subscribe a namespace to an operator. Important You can only subscribe a single instance of the Ansible Automation Platform Operator into a single namespace. Subscribing multiple instances in the same namespace can lead to improper operation for both operator instances. Procedure Create a project for the operator. oc new-project ansible-automation-platform Create a file called sub.yaml . Add the following YAML code to the sub.yaml file. --- apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" name: ansible-automation-platform --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: ansible-automation-platform-operator namespace: ansible-automation-platform spec: targetNamespaces: - ansible-automation-platform --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: ansible-automation-platform namespace: ansible-automation-platform spec: channel: 'stable-2.5' installPlanApproval: Automatic name: ansible-automation-platform-operator source: redhat-operators sourceNamespace: openshift-marketplace --- This file creates a Subscription object called ansible-automation-platform that subscribes the ansible-automation-platform namespace to the ansible-automation-platform-operator operator. Run the oc apply command to create the objects specified in the sub.yaml file: oc apply -f sub.yaml Verify the CSV PHASE reports "Succeeded" before proceeding using the oc get csv -n ansible-automation-platform command: oc get csv -n ansible-automation-platform NAME DISPLAY VERSION REPLACES PHASE aap-operator.v2.5.0-0.1728520175 Ansible Automation Platform 2.5.0+0.1728520175 aap-operator.v2.5.0-0.1727875185 Succeeded Create an AnsibleAutomationPlatform object called example in the ansible-automation-platform namespace. To change the Ansible Automation Platform and its components from from example , edit the name field in the metadata: section and replace example with the name you want to use: oc apply -f - <<EOF apiVersion: aap.ansible.com/v1alpha1 kind: AnsibleAutomationPlatform metadata: name: example namespace: ansible-automation-platform spec: # Platform image_pull_policy: IfNotPresent # Components controller: disabled: false eda: disabled: false hub: disabled: false ## Modify to contain your RWM storage class name storage_type: file file_storage_storage_class: <your-read-write-many-storage-class> file_storage_size: 10Gi ## uncomment if using S3 storage for Content pod # storage_type: S3 # object_storage_s3_secret: example-galaxy-object-storage ## uncomment if using Azure storage for Content pod # storage_type: azure # object_storage_azure_secret: azure-secret-name lightspeed: disabled: true EOF For further information about subscribing namespaces to operators, see Installing from OperatorHub using the CLI in the Red Hat OpenShift Container Platform Operators guide. You can use the OpenShift Container Platform CLI to fetch the web address and the password of the Automation controller that you created. 4.3. Fetching platform gateway login details from the OpenShift Container Platform CLI To login to the platform gateway, you need the web address and the password. 4.3.1. Fetching the platform gateway web address A Red Hat OpenShift Container Platform route exposes a service at a host name, so that external clients can reach it by name. When you created the platform gateway instance, a route was created for it. The route inherits the name that you assigned to the platform gateway object in the YAML file. Use the following command to fetch the routes: oc get routes -n <platform_namespace> In the following example, the example platform gateway is running in the ansible-automation-platform namespace. USD oc get routes -n ansible-automation-platform NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD example example-ansible-automation-platform.apps-crc.testing example-service http edge/Redirect None The address for the platform gateway instance is example-ansible-automation-platform.apps-crc.testing . 4.3.2. Fetching the platform gateway password The YAML block for the platform gateway instance in the AnsibleAutomationPlatform object assigns values to the name and admin_user keys. Use these values in the following command to fetch the password for the platform gateway instance. oc get secret/<your instance name>-<admin_user>-password -o yaml The default value for admin_user is admin . Modify the command if you changed the admin username in the AnsibleAutomationPlatform object. The following example retrieves the password for a platform gateway object called example : oc get secret/example-admin-password -o yaml The base64 encoded password for the platform gateway instance is listed in the metadata field in the output: USD oc get secret/example-admin-password -o yaml apiVersion: v1 data: password: ODzLODzLODzLODzLODzLODzLODzLODzLODzLODzLODzL kind: Secret metadata: labels: app.kubernetes.io/component: aap app.kubernetes.io/name: example app.kubernetes.io/operator-version: "" app.kubernetes.io/part-of: example name: example-admin-password namespace: ansible-automation-platform 4.3.3. Decoding the platform gateway password After you have found your gateway password, you must decode it from base64. Run the following command to decode your password from base64: oc get secret/example-admin-password -o jsonpath={.data.password} | base64 --decode 4.4. Additional resources For more information on running operators on OpenShift Container Platform, navigate to the OpenShift Container Platform product documentation and click the Operators - Working with Operators in OpenShift Container Platform guide.
new-project ansible-automation-platform --- apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" name: ansible-automation-platform --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: ansible-automation-platform-operator namespace: ansible-automation-platform spec: targetNamespaces: - ansible-automation-platform --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: ansible-automation-platform namespace: ansible-automation-platform spec: channel: 'stable-2.5' installPlanApproval: Automatic name: ansible-automation-platform-operator source: redhat-operators sourceNamespace: openshift-marketplace --- apply -f sub.yaml get csv -n ansible-automation-platform NAME DISPLAY VERSION REPLACES PHASE aap-operator.v2.5.0-0.1728520175 Ansible Automation Platform 2.5.0+0.1728520175 aap-operator.v2.5.0-0.1727875185 Succeeded apply -f - <<EOF apiVersion: aap.ansible.com/v1alpha1 kind: AnsibleAutomationPlatform metadata: name: example namespace: ansible-automation-platform spec: # Platform image_pull_policy: IfNotPresent # Components controller: disabled: false eda: disabled: false hub: disabled: false ## Modify to contain your RWM storage class name storage_type: file file_storage_storage_class: <your-read-write-many-storage-class> file_storage_size: 10Gi ## uncomment if using S3 storage for Content pod # storage_type: S3 # object_storage_s3_secret: example-galaxy-object-storage ## uncomment if using Azure storage for Content pod # storage_type: azure # object_storage_azure_secret: azure-secret-name lightspeed: disabled: true EOF get routes -n <platform_namespace> oc get routes -n ansible-automation-platform NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD example example-ansible-automation-platform.apps-crc.testing example-service http edge/Redirect None get secret/<your instance name>-<admin_user>-password -o yaml get secret/example-admin-password -o yaml oc get secret/example-admin-password -o yaml apiVersion: v1 data: password: ODzLODzLODzLODzLODzLODzLODzLODzLODzLODzLODzL kind: Secret metadata: labels: app.kubernetes.io/component: aap app.kubernetes.io/name: example app.kubernetes.io/operator-version: "" app.kubernetes.io/part-of: example name: example-admin-password namespace: ansible-automation-platform get secret/example-admin-password -o jsonpath={.data.password} | base64 --decode