Bookmark this page

Lab: Backup and Restore Red Hat Ansible Automation Platform

  • Create a backup of your existing Red Hat Ansible Automation Platform deployment, remove some resources from the deployment, and then use the backup to restore the deployment.

Outcomes

  • Create a backup of your Red Hat Ansible Automation Platform deployment.

  • Restore your Red Hat Ansible Automation Platform deployment.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available. The command performs the following tasks:

  • Removes automation controller and private automation hub resources created in previous chapters.

  • Downloads and extracts the installation bundle to the /home/student/aap2.2-bundle directory (if necessary).

  • Creates a job template, a machine credential, a project, and an inventory in automation controller. All of these resources use the Backup_Restore name.

[student@workstation ~]$ lab start compreview-backup

Specifications

  • Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password. Verify that the lab command created a job template, a machine credential, a project, and an inventory (using Backup_Restore as the name of each resource).

  • Create a backup of your Red Hat Ansible Automation Platform deployment by using the installer in the /home/student/aap2.2-bundle directory. Verify that the backup process created the automation-platform-backup-latest.tar.gz symbolic link within that directory.

  • Remove the automation controller resources that use the Backup_Restore name.

    Important

    This step is not part of a typical backup and restore process. You remove resources in this exercise so that you can verify that the restoration process recovers the resources.

  • Use the previously created backup file to restore your Red Hat Ansible Automation Platform deployment. Verify that the restoration process recovered the Backup_Restore resources.

  1. Use the automation controller web UI to verify the existence of the resources that use the Backup_Restore name.

    1. Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.

    2. Navigate to ResourcesTemplates. The Backup_Restore job template uses the Backup_Restore machine credential, the Backup_Restore project, and the Backup_Restore inventory.

      Click the Launch Template icon for the Backup_Restore job template. The job succeeds and displays the following output:

      ...output omitted...
      ok: [workstation.lab.example.com] => {
          "msg": "This is the backup and restore job template."
      }
      ...output omitted...
    3. Navigate to ResourcesCredentials. The Backup_Restore job template uses the Backup_Restore machine credential to connect to hosts in the Backup_Restore inventory.

    4. Navigate to ResourcesProjects. The Backup_Restore project contains the playbook used by the Backup_Restore job template and the inventory file used by the Backup_Restore inventory.

    5. Navigate to ResourcesInventories. The Backup_Restore inventory uses the inventory file sourced from the Backup_Restore project. The Backup_Restore inventory contains the workstation.lab.example.com host.

  2. Create a backup of your Red Hat Ansible Automation Platform deployment.

    1. From a terminal window, become the root user, using student as the password.

      [student@workstation ~]$ sudo -i
      [sudo] password for student: student
      [root@workstation ~]#
    2. Change to the /home/student/aap2.2-bundle directory.

      [root@workstation ~]# cd /home/student/aap2.2-bundle/
    3. Initiate the backup process using the setup.sh script. The script takes a few minutes to complete. If your Red Hat Ansible Automation Platform deployment included automation mesh, then your output also displays the control2.lab.example.com host.

      [root@workstation aap2.2-bundle]# ./setup.sh -b
      ..output omitted...
      PLAY RECAP *********************************************************************
      controller.lab.example.com : ok=59   changed=33  ...  failed=0  skipped=85  ...
      hub.lab.example.com        : ok=37   changed=14  ...  failed=0  skipped=67  ...
      localhost                  : ok=2    changed=0   ...  failed=0  skipped=0   ...
      
      The setup process completed successfully.
      [warn] /var/log/tower does not exist. Setup log saved to backup.log.
    4. Verify that the backup created the automation-platform-backup-latest.tar.gz symbolic link. The symbolic link points to the latest backup file.

      [root@workstation aap2.2-bundle]# ls -l automation-platform-backup-latest.tar.gz
      lrwxrwxrwx. 1 root root 83 Aug  9 14:36 automation-platform-backup-latest.tar.gz -> /home/student/aap2.2-bundle/./automation-platform-backup-2022-08-09-14:34:24.tar.gz
  3. Remove the automation controller resources that use the Backup_Restore name.

    Important

    This step is not part of a typical backup and restore process. You remove resources in this exercise so that you can verify that the restoration process recovers the resources.

    1. Navigate to ResourcesTemplates. Select the Backup_Restore job template and click Delete. Verify that you want to delete the template by clicking Delete.

    2. Navigate to ResourcesCredentials. Select the Backup_Restore machine credential and click Delete. Verify that you want to delete the credential by clicking Delete.

    3. Navigate to ResourcesInventories. Select the Backup_Restore inventory and click Delete. Verify that you want to delete the inventory by clicking Delete.

    4. Navigate to ResourcesProjects. Select the Backup_Restore project and click Delete. Verify that you want to delete the project by clicking Delete.

  4. Recover your Red Hat Ansible Automation Platform deployment.

    1. Initiate the restoration process using the setup.sh script in the /home/student/aap2.2-bundle directory. The script takes a few minutes to complete. If your Red Hat Ansible Automation Platform deployment included automation mesh, then your output also displays the control2.lab.example.com host.

      [root@workstation aap2.2-bundle]# ./setup.sh -r
      ..output omitted...
      PLAY RECAP *********************************************************************
      controller.lab.example.com : ok=60   changed=21  ...  failed=0  skipped=85  ...
      db.lab.example.com         : ok=6    changed=6   ...  failed=0  skipped=0   ...
      hub.lab.example.com        : ok=35   changed=13  ...  failed=0  skipped=56  ...
      
      The setup process completed successfully.
      [warn] /var/log/tower does not exist. Setup log saved to backup.log.
    2. Navigate to ResourcesCredentials. The restoration process recovered the Backup_Restore machine credential.

    3. Navigate to ResourcesInventories. The restoration process recovered the Backup_Restore inventory.

    4. Navigate to ResourcesProjects. The restoration process recovered the Backup_Restore project.

    5. Navigate to ResourcesTemplates. The restoration process recovered the Backup_Restore job template.

      Click the Launch Template icon for the Backup_Restore job template. The job succeeds and displays the following output:

      ...output omitted...
      ok: [workstation.lab.example.com] => {
          "msg": "This is the backup and restore job template."
      }
      ...output omitted...

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish compreview-backup

This concludes the section.

Revision: do467-2.2-08877c1