Documentation

8. Create a new Inventory and add it to the Organization

An inventory is a collection of hosts managed by Tower. Inventories are assigned to organizations, while permissions to launch playbooks against inventories are controlled at the user and/or team level. For more information, refer to Inventories, Users - Permissions, and Teams - Permissions in the “Tower User Guide”.

Create a new inventory by browsing to the Inventories main navigation link and clicking the plus button.

Inventories - create new inventory

Enter the values for Name and Description. Leave the organization set as default in the Organization field.

Inventories - select organization for new inventory

For now, ignore the Variables field. Click the Save button at the bottom of the page to create the inventory.

Inventories - click to save new inventory

After clicking Save, ‘Scan Job Templates’ becomes available at the bottom of the screen. For now, ignore this section. For more information, refer to Job Templates in the “Tower User Guide”. Click Save again and a populated Inventories screen appears.

Inventories - groups home

Click on the ‘Web Servers’ link for the inventory you created.

Note that inventories are divided into groups and hosts. A group might represent a particular environment (e.g. “Datacenter 1” or “Stage Testing”), a server type (e.g. “Application Servers” or “DB Servers”), or any other representation of your environment.

The left side of the screen displays the groups that belong to the Web Servers inventory. The right side displays hosts.

Inventories - click to create new group

Note

Prior to Ansible Tower 2.2, hosts could not be added to the Web Servers inventory before adding a group. If you are using an older version of Tower, click the plus button above the ‘Groups’ section to add a group before adding a host.

For this example, suppose that the organization you created earlier has a group of web server hosts supporting the corporate CMS application. To add these hosts to the Web Servers inventory, create a “CMS Web” group. Click the Save button to create the group.

Beginning with Ansible Tower 2.2, hosts can be added directly to the inventory root or created under a group. In the “Web Servers” inventory you created, select the plus button above ‘Hosts’ to create the new host. (To add a host to a group, click on the group to which the host should be assigned and add the host from there.)

Note

For the purposes of this Quick Start and to test that Tower is setup properly, add a host that you can reach via SSH and manage using Ansible (i.e. that meets the Ansible requirements). The simple Ansible playbook launched will not harm or alter the target in any way. If you cannot reach the host via SSH, the playbook launched later in this Quick Guide will fail.

Enter the “Host Name”, either the DNS resolvable name of the host or its IP address. The Description is arbitrary. Click Save to finish adding the host.

Inventories - host properties form

Click Save to finish adding the host.

Inventories - hosts index showing added host