Bookmark this page

Lab: Administering Ansible

In this lab, you will create an inventory in Red Hat Ansible Tower for managing network resources.

Outcomes

You should be able to:

  • Create an inventory in Red Hat Ansible Tower.

  • Add a host group to the inventory you created.

  • Add child groups to a parent group.

  • Add hosts to groups.

Open Firefox on the workstation VM. Log in to Ansible Tower at http://tower.lab.example.com as the user admin using student as the password.

  1. Create an inventory in Red Hat Ansible Tower named lab.example.com.

    1. Click the INVENTORIES navigation link at the top of the screen.

    2. Create the new Inventory. On the INVENTORIES screen, click ADD and select Inventory (not Smart Inventory).

      On the DETAILS panel of the INVENTORIES / CREATE INVENTORY screen, the NAME and ORGANIZATION fields are required. Use lab.example.com for NAME, and click the magnifying glass icon to select the Default organization. Click SAVE.

  2. Add a host group named network to the inventory you created. Associate the ansible_connection: network_cli variable and value pair with the group.

    1. On the DETAILS panel of the INVENTORIES / lab.example.com screen, select GROUPS, and then click ADD GROUP. On the CREATE GROUP screen, enter network in the NAME field. In the VARIABLES field, type the following:

      ---
      ansible_connection: network_cli

      Click SAVE to finalize the addition of the group to the inventory.

  3. Add the child groups vyos and ios to the parent group network.

    The vyos group should set the ansible_network_os: vyos and ansible_user: vyos variables. The ios group should set ansible_network_os: ios and ansible_user: admin variables.

    1. On the DETAILS panel of the INVENTORIES / lab.example.com / GROUPS /network screen, select GROUPS. Click ADD and select New Group.

    2. On the DETAILS panel of the CREATE GROUP screen, enter vyos in the NAME field. In the VARIABLES field, define the variables as shown below.

      ---
      ansible_network_os: vyos
      ansible_user: vyos

      Click SAVE to finalize the addition of the child group to the inventory.

    3. On the GROUPS panel of the INVENTORIES / lab.example.com / GROUPS /network screen (ASSOCIATED GROUPS), click ADD and select New Group.

    4. On the DETAILS panel of the CREATE GROUP screen, enter ios in the NAME field. In the VARIABLES field, define the variables as shown below.

      ---
      ansible_network_os: ios
      ansible_user: admin

      Click SAVE to finalize the addition of the child group to the inventory.

  4. Add the spine01, spine02, leaf01, and leaf02 hosts to the vyos group. Add the cs01 host to the ios group.

    1. Add spine01, spine02, leaf01, and leaf02 to the vyos group.

      1. On the GROUPS panel of the INVENTORIES / lab.example.com / GROUPS / network screen (ASSOCIATED GROUPS), click the vyos link.

      2. On the GROUPS panel of the INVENTORIES / lab.example.com / GROUPS / vyos screen (ASSOCIATED GROUPS), select HOSTS.

      3. On the HOSTS panel, click ADD and select New Host. On the CREATE HOST screen, enter spine01 in the NAME field. Click SAVE to finalize the addition of the host to the child group.

      4. On the HOSTS panel, click ADD and select New Host to repeat the process and add spine02, leaf01 and leaf02 to the group.

    2. Add cs01 to the ios group.

      1. On the GROUPS link in the breadcrumbs to go to the GROUPS panel of the INVENTORIES / lab.example.com screen.

      2. Click the network link to go to the GROUPS panel of the INVENTORIES / lab.example.com / GROUPS / network screen (ASSOCIATED GROUPS).

      3. Click the ios link to go to the GROUPS panel of the INVENTORIES / lab.example.com / GROUPS / ios screen (ASSOCIATED GROUPS).

      4. Select HOSTS to go to the HOSTS panel. Click ADD and select New Host. Enter cs01 in the HOST NAME field and then click SAVE to finalize the addition of the host to the group.

This concludes the lab.

Revision: do457-2.5-4693601