Bookmark this page

Guided Exercise: Creating a Static Inventory

  • Create a static inventory in automation controller and grant teams permission to administer and use that inventory.

Outcomes

  • Create a static inventory containing hosts and a host group.

  • Assign appropriate inventory permissions to a team.

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

This command ensures that automation controller is installed and configured with any necessary resources created in previous exercises. The command also creates an additional inventory, with hosts and a host group, needed for this exercise.

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

Procedure 3.1. Instructions

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

  2. Create a static inventory named Prod.

    1. Navigate to ResourcesInventories and then click AddAdd inventory.

    2. On the Create new inventory page, enter the following details:

      FieldValue
      Name Prod
      Description Production Inventory
      Organization Default
    3. Click Save to create the new inventory. You are redirected to the inventory Details page for the Prod inventory.

  3. Create the prod_servers group in the Prod inventory.

    1. Click the Groups tab and then click Add to add a new group.

    2. On the Create new group page, enter the following details:

      FieldValue
      Name prod_servers
      Description Production servers
    3. Click Save to create the new group.

  4. Add the servere.lab.example.com host to the prod_servers group in the Prod inventory.

    1. Click the Hosts tab to add hosts to the group you just created.

    2. Click AddAdd new host to add a new host to the group.

    3. On the Create new host page, enter the following details:

      FieldValue
      Name servere.lab.example.com
      Description Server E
    4. Click Save to add the new host.

  5. Assign the Operations team the Admin role on the Prod inventory.

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

    2. On the Access tab, click Add to add permissions.

    3. Click Teams and then click Next to display the list of available teams.

    4. Select the Operations team, and then click Next to display the possible roles to apply.

    5. Select the Admin role.

    6. Click Save to finalize the role assignment. This redirects you to the list of permissions for the Prod inventory, which now shows that all members of the Operations team are assigned the Admin role on the Prod inventory.

  6. Verify access to the Prod inventory with the oliver user, who belongs to the Operations team.

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

    2. Navigate to ResourcesInventories and then click the link for the Prod inventory created earlier.

    3. Review the contents of the Prod inventory to see the hosts and group it contains.

  7. Add the serverf.lab.example.com host to the Prod inventory while logged in as the oliver user.

    1. Click ResourcesInventories and then click the link for the Prod inventory.

    2. On the Groups tab, click the link for the prod_servers group to enter the group.

    3. On the Hosts tab, click AddAdd new host to add a new host to the group.

    4. On the Create new host page, enter the following details, and then click Save:

      FieldValue
      Name serverf.lab.example.com
      Description Server F
  8. Assign the Use role on the Test inventory to the Developers team.

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

    2. Navigate to ResourcesInventories and click the link for the Test inventory.

    3. On the Access tab, click Add to add permissions.

    4. Click Teams and then click Next to display the list of available teams.

    5. Select the Developers team, and then click Next to display the possible roles to apply.

    6. Select the Use role and then click Save. This redirects you to the list of permissions for the Test inventory, which now shows that normal members of the Developers team are assigned the Use role on the Test inventory. The donnie user does not inherit this permission because donnie only has read access on the Developers team.

  9. Verify access to the Test inventory with the daniel user, who belongs to the Developers team.

    1. Log out and then log back in as the daniel user with the password redhat123. This user is assigned the Admin role for the Developers team.

    2. Navigate to ResourcesInventories and click the link for the Test inventory.

    3. Review the contents of the Test inventory to see the hosts and group it contains. Note that even though daniel is an Admin of the Developers team, he cannot manage the Test inventory because you only granted the Use role for the inventory to the Developers team.

      Note

      This is representative of a real world scenario where developers might have access to the list of systems in the testing environment but are not able to modify the list.

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

This concludes the section.

Revision: do467-2.2-08877c1