[Short Tip] Use Red Hat Satellite 6 as an inventory resource in Ansible

Ansible Logo

Besides static file inventories, Ansible can use custom scripts to dynamically generate inventories or access other sources, for example a CMDB or a system management server – like Red Hat Satellite.
Luckily, Nick Strugnell has already written a custom script to use Satellite as an inventory source in Ansible.

After checking out the git, the hammer.ini needs to be adjusted: at least host, username, password and organization must be adjusted.

Afterwards, the script can be invoked directly to show the available hosts:

$ ansible -i ~/Github/ansible-satellite6/satellite-inventory.py all --list-hosts

This works with ansible CLI and playbook calls:

$ ansible-playbook -i ~/Github/ansible-satellite6/satellite-inventory.py apache-setup.yml
PLAY [apache setup] *********************************************************** 

GATHERING FACTS *************************************************************** 

The script works quite well – as long as the certificate you use on the Satellite server is trusted. Otherwise the value for self.ssl_verify must be set to False. Besides, it is a nice and simple way to access already existing inventory stores. This is important because Ansible is all about integration, and not about “throwing away and making new”.


8 thoughts on “[Short Tip] Use Red Hat Satellite 6 as an inventory resource in Ansible”

  1. May it be possible not to show these blog posts on the KDE-related planetkde.org site? I don’t want to offend anyone, it is just not related.

  2. You are not offending. I actually already had the discussion with the KDE team to not include my entire blog on planetkde, but for example only the “KDE” category. Last time (already quite some time ago) it wasn’t worth the effort since I posted a lot of KDE content anyway, but that has declined recently. I will ask again =)

Comments are closed.