Bookmark this page

Guided Exercise: Creating Machine Credentials for Access to Inventory Hosts

  • Create a machine credential and assign roles to teams that permit members of those teams to use that credential.

Outcomes

  • Create a machine credential.

  • Assign roles to the machine credential.

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

This command ensures that the automation controller is installed and configured with any necessary resources created in previous exercises.

[student@workstation ~]$ lab start host-credential

Procedure 3.2. Instructions

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

  2. Create a new credential called Operations.

    1. Navigate to ResourcesCredentials.

    2. Click Add to add a new credential.

    3. On the next page, fill in the details as follows:

      FieldValue
      Name Operations
      Description Operations Credential
      Organization Default
      Credential Type Machine
      Username devops
      Password redhat
      Privilege Escalation Method sudo
      Privilege Escalation Username root

      Note

      Because the devops user does not need to enter a password to run sudo commands, you do not need to enter a password in the Privilege Escalation Password field.

    4. Leave the other fields untouched and click Save to create the new credential.

  3. Assign the Operations team the Admin role on the Operations credential.

    1. Navigate to ResourcesCredentials.

    2. Click the Operations credential and then click the Access tab.

    3. Click Add to add access permissions.

    4. Click Teams, and then click Next.

    5. Select the Operations team and then click Next.

    6. Select the Admin role.

    7. Click Save. This redirects you to the list of access permissions for the Operations credential, which now shows that all members of the Operations team, oliver and ophelia, are assigned the Admin role on the Operations credential.

  4. Verify access of the Admin role to the Operations credential with the oliver user, who belongs to the Operations team.

    1. Log out and log back in as oliver using redhat123 as the password. This user is assigned the Member role for the Operations team.

    2. Navigate to ResourcesCredentials and then click the link for the Operations credential that you created earlier.

    3. Notice that the oliver user can modify the credential.

  5. Assign the Developers team the Use role on the Operations credential.

    1. Log out and log back in as the admin user with redhat as the password.

    2. Navigate to ResourcesCredentials.

    3. Click the Operations credential and then click the Access tab.

    4. Click Add to add access permissions.

    5. Click Teams and then click Next.

    6. Select the Developers team and then click Next.

    7. Select the Use role.

    8. Click Save. This redirects you to the list of access permissions for the Operations credential, which now shows that all members of the Developers team, daniel and david, are assigned the Use role on the Operations credential.

  6. Verify the Use role for the Operations credential with the daniel user, who belongs to the Developers team.

    1. Log out and log back in as daniel using redhat123 as the password. This user has an Admin role for the Developers team.

    2. Navigate to ResourcesCredentials.

    3. Click the Operations credential and then click the Access tab. Notice that the daniel user cannot modify the credential even though he has an Admin role for the team.

    4. Log out of the automation controller web UI.

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 host-credential

This concludes the section.

Revision: do467-2.2-08877c1