Bookmark this page

Lab: Managing Inventories and Machine Credentials

  • Create inventories and credentials and assign roles to teams that permit members of those teams to manage the new inventories.

Outcomes

  • Manage inventories.

  • Manage credentials.

  • Allow a team to run a playbook against an inventory.

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

This command ensures that private automation hub and automation controller are installed and configured with any necessary resources created in previous exercises.

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

Procedure 3.3. Instructions

  1. Create a new automation controller inventory called Dev within the Default organization. Use Development Inventory as the description. Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.

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

    2. Navigate to ResourcesInventories and then click Add. Select Add inventory.

    3. Create the new inventory using the following information, and then click Save.

      FieldValue
      Name Dev
      Description Development Inventory
      Organization Default
  2. Create a host group called dev_servers in the Dev inventory. Use Development servers as the description.

    1. From the Dev inventory details page, click the Groups tab and then click Add.

    2. Create a new host group called dev_servers and use Development servers as the description.

    3. Click Save.

  3. Add two hosts with the hostnames servera.lab.example.com and serverb.lab.example.com to the dev_servers host group. Use Server A as the description for the servera.lab.example.com host and use Server B as the description for the serverb.lab.example.com host.

    1. From the dev_servers group details page, click the Hosts tab and then click Add. Select Add new host.

    2. Create the servera.lab.example.com host and use Server A as the description.

    3. Click Save.

    4. Return to the dev_servers group details page. Navigate to ResourcesInventories and then click the link for the Dev inventory. Click the Groups tab and then click the link for the dev_servers group.

    5. From the dev_servers group details page, click the Hosts tab and then click Add. Select Add new host.

    6. Create the serverb.lab.example.com host and use Server B as the description.

    7. Click Save.

  4. Grant the Admin role on the Dev inventory to the Developers team.

    1. Navigate to ResourcesInventories and then click the link for the Dev inventory.

    2. Click the Access tab and then click Add.

    3. Select Teams and then click Next.

    4. Select Developers and then click Next.

    5. Select Admin and then click Save. You are redirected to the list of permissions for the Dev inventory, which now shows that all members of the Developers team are assigned the Admin role on the Dev inventory.

  5. Create a new machine credential with the following information:

    Table 3.1. Developers Credential

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

    1. Navigate to ResourcesCredentials and then click Add.

    2. Create a new machine credential using information from the Developers Credential table. When finished, click Save.

      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.

  6. Grant the Admin role on the Developers credential to the Developers team.

    1. Navigate to ResourcesCredentials and then click the link for the Developers credential.

    2. Click the Access tab and then click Add.

    3. Select Teams and then click Next.

    4. Select Developers and then click Next.

    5. Select Admin and then click Save. You are redirected to the list of permissions for the Developers credential, which now shows that all members of the Developers team are assigned the Admin role on the Developers credential.

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-review

This concludes the section.

Revision: do467-2.2-08877c1