Ansible Tower: Loading partial Satellite inventories

Florian Moss
3 min readNov 1, 2020

The following post will demonstrate how a full Red Hat Satellite can be synced with Ansible Tower, as well as a partial inventory. This can be useful — or necessary if you only want to manage specific hosts and don’t want to pay unnecessarily for nodes.

Step 1: Create the Red Hat Satellite Credential in Ansible Tower

I won’t go into too much detail for this, as it is fairly basic. Simply create a new credential that authenticates against your Satellite environment. This will look similar to this:

(!) The URL required HTTP or HTTPS in front of it.

Step 2: Synchronize a full Satellite Inventory — if you want

Select Inventories, then (+) Inventory. Enter a meaningful name such as “All Hosts — Satellite”, assign an Organization, and select Save.

Then select Sources, (+) and enter a meaningful name such as “Satellite Credentials for Localdomain” and select “Red Hat Satellite 6” under Source. Finally, select Save.

Fill out the rest of the fields as seen below — the Credential Name might be different, depending on the name you used:

Start the syncing process with the Update icon as shown below.

Step 3: Investigate available Host Variables

Select Hosts within the Inventory you just created and select a random Host. Copy the content from the Variables field into a text document and investigate it.

Personally, I find the hostgroup_title quite useful. We will use this variable as a filter to demonstrate how filters can be used for Satellite inventories.

Step 4: Create a Host Group (or skip if existent)

To filter by hostgroup_title, a Host Group need to be existent. Create a new Host Group as seen below:

If you have never done it before, here is more information on it:

For this demo, I added a single resource (server1.localdomain) to the newly created Host Group with the title: Compute Resources.

Step 5: Create a partial Satellite Inveotry — based on filters

Create another inventory as described in Step 2. Give it the name “Partial Satellite Inventory” — or any other meaningful name.

The only difference is now that we are adding a host_filter within the source, as seen below:

You can imagine what happens: The available hosts will be filtered by the variable hostgroup_title being == “Compute Resources”. You can chain multiple filters of course or use any other variable (seen in Step 3).

Step 6: Confirm the Partial Output

To make sure that the filter worked we can simply look at the hosts available within the newly created inventory. As you can see below, the filter was applied as expected and only a single host was synced:

Summary

This blog post demonstrated how you can sync a full and a partial Red Hat Satellite inventory with Ansible Tower — using a simple host filter.

--

--