Chapter 3. Recovering a Red Hat Ansible Automation Platform deployment If you lose information on your system or experience issues with an upgrade, you can use the backup resources of your deployment instances. Use the following procedures to recover your Ansible Automation Platform deployment files. 3.1. Recovering your Ansible Automation Platform deployment Ansible Automation Platform manages any enabled components (such as, automation controller, automation hub, and Event-Driven Ansible), when you recover Ansible Automation Platform you also restore these components. In versions of the Ansible Automation Platform Operator, it was necessary to create a restore object for each component of the platform. Now, you create a single AnsibleAutomationPlatformRestore resource, which creates and manages the other restore objects: AutomationControllerRestore AutomationHubRestore EDARestore Prerequisites You must be authenticated with an OpenShift cluster. You have installed the Ansible Automation Platform Operator on the cluster. The AnsibleAutomationPlatformBackups deployment is available in your cluster. Procedure Log in to Red Hat OpenShift Container Platform. Navigate to Operators Installed Operators . Select your Ansible Automation Platform Operator deployment. Go to your All Instances tab, and click Create New . Select Ansible Automation Platform Restore from the list. For Name enter the name for the recovery deployment. For New Ansible Automation Platform Name enter the new name for your Ansible Automation Platform instance. Backup Source defaults to CR . For Backup name enter the name your chose when creating the backup. Click Create . Your backups starts restoring under the AnsibleAutomationPlatformRestores tab. Note The recovery is not complete until all the resources are successfully restored. Depending on the size of your database this this can take some time. Verification To verify that your recovery was successful you can: Go to Workloads Pods . Confirm that all pods are in a Running or Completed state. 3.2. Recovering the Automation controller deployment Use this procedure to restore a controller deployment from an AutomationControllerBackup. The deployment name you provide will be the name of the new AutomationController custom resource that will be created. Note The name specified for the new AutomationController custom resource must not match an existing deployment. If the backup custom resource being restored is a backup of a currently running AutomationController custom resource the recovery process will fail. See Troubleshooting for steps to resolve the issue. Prerequisites You must be authenticated with an OpenShift cluster. You have deployed automation controller on the cluster. An AutomationControllerBackup is available on a PVC in your cluster. Procedure Log in to Red Hat OpenShift Container Platform. Navigate to Operators Installed Operators . Select your Ansible Automation Platform Operator deployment. Select the Automation Controller Restore tab. Click Create AutomationControllerRestore . Enter a Name for the recovery deployment. Enter a New Deployment name for the restored deployment. Note This must be different from the original deployment name. Select the Backup source to restore from . Backup CR is recommended. Enter the Backup Name of the AutomationControllerBackup object. Click Create . A new deployment is created and your backup is restored to it. This can take approximately 5 to 15 minutes depending on the size of your database. Verification Log in to Red Hat Red Hat OpenShift Container Platform. Navigate to Operators Installed Operators . Select your Ansible Automation Platform Operator deployment. Select the AutomationControllerRestore tab. Select the restore resource you want to verify. Scroll to Conditions and check that the Successful status is True . Note If Successful is False , the recovery has failed. Check the automation controller operator logs for the error to fix the issue. 3.3. Using YAML to recover the Automation controller deployment See the following procedure for how to restore a deployment of the automation controller using YAML. Prerequisite The external database must be a PostgreSQL database that is the version supported by the current release of Ansible Automation Platform. Note Ansible Automation Platform 2.5 supports PostgreSQL 15. Procedure The external postgres instance credentials and connection information must be stored in a secret, which is then set on the automation controller spec. Create a external-postgres-configuration-secret YAML file, following the template below: apiVersion: v1 kind: Secret metadata: name: external-restore-postgres-configuration namespace: <target_namespace> 1 stringData: host: "<external_ip_or_url_resolvable_by_the_cluster>" 2 port: "<external_port>" 3 database: "<desired_database_name>" username: "<username_to_connect_as>" password: "<password_to_connect_with>" 4 sslmode: "prefer" 5 type: "unmanaged" type: Opaque 1 Namespace to create the secret in. This should be the same namespace you want to deploy to. 2 The resolvable hostname for your database node. 3 External port defaults to 5432 . 4 Value for variable password should not contain single or double quotes (', ") or backslashes (\) to avoid any issues during deployment, backup or restoration. 5 The variable sslmode is valid for external databases only. The allowed values are: prefer , disable , allow , require , verify-ca , and verify-full . Apply external-postgres-configuration-secret.yml to your cluster using the oc create command. USD oc create -f external-postgres-configuration-secret.yml When creating your AutomationControllerRestore custom resource object, specify the secret on your spec, following the example below: kind: AutomationControllerRestore apiVersion: automationcontroller.ansible.com/v1beta1 metadata: namespace: my-namespace name: AutomationControllerRestore-2024-07-15 spec: deployment_name: restored_controller backup_name: AutomationControllerBackup-2024-07-15 postgres_configuration_secret: 'external-restore-postgres-configuration' 3.4. Recovering the Automation hub deployment Use this procedure to restore a hub deployment into the namespace. The deployment name you provide will be the name of the new AutomationHub custom resource that will be created. Note The name specified for the new AutomationHub custom resource must not match an existing deployment or the recovery process will fail. Prerequisites You must be authenticated with an OpenShift cluster. You have deployed automation hub on the cluster. An AutomationHubBackup is available on a PVC in your cluster. Procedure Log in to Red Hat OpenShift Container Platform. Navigate to Operators Installed Operators . Select your Ansible Automation Platform Operator deployment. Select the Automation Hub Restore tab. Click Create AutomationHubRestore . Enter a Name for the recovery deployment. Select the Backup source to restore from. Backup CR is recommended. Enter the Backup Name of the AutomationHubBackup object. Click Create . This creates a new deployment and restores your backup to it.

Commands:
apiVersion: v1 kind: Secret metadata: name: external-restore-postgres-configuration namespace: <target_namespace> 1 stringData: host: "<external_ip_or_url_resolvable_by_the_cluster>" 2 port: "<external_port>" 3 database: "<desired_database_name>" username: "<username_to_connect_as>" password: "<password_to_connect_with>" 4 sslmode: "prefer" 5 type: "unmanaged" type: Opaque
oc create -f external-postgres-configuration-secret.yml
kind: AutomationControllerRestore apiVersion: automationcontroller.ansible.com/v1beta1 metadata: namespace: my-namespace name: AutomationControllerRestore-2024-07-15 spec: deployment_name: restored_controller backup_name: AutomationControllerBackup-2024-07-15 postgres_configuration_secret: 'external-restore-postgres-configuration'