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 button.
Enter the values for Name and Description. Leave the organization set as default in the Organization field.
For now, ignore the Variables field. Click the Save button at the bottom of the page to create the 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.
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.
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 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 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.
Click Save to finish adding the host.