Bookmark this page

Guided Exercise: Managing Playbooks with Automation Controller

Run a playbook by using a preconfigured automation controller from Red Hat Ansible Automation Platform.

Outcomes

  • Log in to an existing automation controller as a non-administrative user.

  • Run an Ansible Playbook by using Red Hat Ansible Automation Platform.

  • Confirm that the non-administrative user can use the credential object but not modify or view it.

As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.

[student@workstation ~]$ lab start ansible-controller-intro

Instructions

  1. On workstation, open Firefox to access https://controller.lab.example.com. If you encounter a warning that the dashboard's TLS certificate cannot be authenticated in this classroom, ignore the warning and add the certificate to your browser as an exception.

  2. Log in to the automation controller dashboard as the admin user with the redhat password.

  3. Verify that the ansible-testuser user exists in the automation controller.

    1. Navigate to the AccessUsers dashboard. You should see the ansible-testuser user in the list that appears.

  4. Add the ansible-testuser user to the Default organization with the Member role.

    1. Navigate to the AccessOrganizations dashboard.

    2. Click the Default organization and navigate to the Access tab for the organization.

    3. Click Add and follow the prompts to add the ansible-testuser user to the organization. Apply the Member role to the user from the roles list.

  5. Verify that the ansible-testuser-credential machine credential exists. Also, grant the Use role to the ansible-testuser user for the machine credential so that the user can authenticate to managed hosts while executing the Ansible Playbook.

    1. Navigate to the ResourcesCredentials menu. Verify that the ansible-testuser-credential item appears in the displayed list of available credentials.

    2. Click the ansible-testuser-credential link and navigate to the Access tab.

    3. Click Add and follow the prompts to add the ansible-testuser user. Apply the Use role from the roles list.

  6. Verify that the RH415_project project exists in the automation controller. Also, grant the Use role to the ansible-testuser user on this project.

    1. Navigate to the ResourcesProjects menu. Verify that the RH415_project project appears in the list that is displayed.

    2. Click the RH415_project link and navigate to the Access tab for the project.

    3. Click Add and follow the prompts to add the ansible-testuser user. Assign the Use role from the roles list.

  7. Create the RH415-inventory static inventory.

    1. Navigate to the ResourcesInventories menu.

    2. Click Add to add an inventory. Use RH415-inventory for the inventory name and click Save.

  8. Grant the Use and Ad Hoc permissions to the ansible-testuser user for the RH415-inventory inventory.

    1. Navigate to the Access tab for the RH415-inventory inventory.

    2. Follow the prompts to add the ansible-testuser user. Assign the Use and Ad Hoc roles from the role list.

  9. Create the webservers group within the RH415-inventory inventory to include the servera and serverb managed hosts.

    1. Navigate to the Groups tab for the RH415-inventory inventory.

    2. Click Add.

    3. Specify webservers for the group name and click Save.

    4. Navigate to the Hosts tab and click Add to add a new host. Specify servera for the hostname and click Save.

    5. Repeat the same steps to add the serverb host as well.

  10. As the ansible-testuser user, verify that the ansible-testuser-credential machine credential exists.

    1. Log out of the admin user by clicking the username in the upper right corner of the page and selecting Logout.

    2. Log in as the ansible-testuser user with the redhat password in the automation controller dashboard.

    3. Navigate to the ResourcesCredentials dashboard. You cannot modify the properties of the credential, because the ansible-testuser user is limited to the Use role. The Use role allows you to use this credential object to authenticate to the managed hosts while executing the Ansible Playbook, but it does not grant you the privileges to modify the properties of the credential object.

  11. Create a job template called RH415-job in the RH415_project project.

    1. Navigate to the ResourcesTemplates dashboard.

    2. Click Add to add a new job template. Specify RH415-job for the job template name and use RH415-inventory for the inventory. You can click the Search button that is associated with the inventory field to pick the inventory from a list.

    3. Ensure that RH415_project is selected for the project.

    4. Select hello_world.yml from the drop-down menu in the Playbook field.

    5. Click the Search button of the Credentials field and select the radio button beside the ansible-testuser-credential item. Click Select to confirm the selection.

    6. Click Save.

  12. Launch the RH415-job job template.

    1. Navigate to the ResourcesTemplates dashboard and click the Launch Template button with a rocket icon to the right of the RH415-job template. Verify that the job completes with a Successful state.

Finish

On the workstation machine, 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 ansible-controller-intro

Revision: rh415-9.2-a821299