Ansible Tower Update Satellite Inventory

Latest response

Ansible Tower 3.62, Satellite 6.5

We are running into problems with a Satellite Dynamic Inventory with Ansible Tower. Refreshing the Satellite inventory takes quite a long time. There is an option to refresh the inventory automatically which would be extremely helpful in provisioning, however that option is an 'inventory source' option, not a 'job template' option. The result is that enabling the inventory update will cause an lengthy delay any time any job template that references the inventory is run. This is un-tenable, as other jobs (that also use the Satellite inventory) queue up, and then those want to update the inventory and so on and so on.

It occurs to me that the option to update the inventory automatically might be better left on the 'job template' configuration. This way, the update of the inventory could me performed only when necessary (like when provisioning a new host) and skipped when it might not be needed. Is there any way to accomplish this? As an aside, Updating the Ansible Playbook via SCM has a similar issue: auto update is a 'Project' option instead of a 'template' option, but only takes a few seconds so is not really an issue for me.

Responses

HI Rob, YEs i agree with you, this is showstopper when inventory and project sync gets more time, also it goes to pending while template running from same project. we have scheduled inventory sync every night where no jobs used to run from project. also we can make bit simpler. update your inventory manually after with newly provisioned host once after provisioning and make override box clicked in inventory source, once after all your work scheduled run will update your inventory with latest one.

Unfortunately, manually adding hosts for provisioning isn't really a super option; we frequently provision (and decommission) hosts in an automated process and adding them manually would be a constant headache. I've been able to workaround the issue (somewhat) by issuing a curl command in the new host's kickstart script just prior to the Ansible callback. The curl command adds a new host to a 'provisioning' inventory so that the provisioning playbook can run on that new host. It works OK I guess but it's the sort of thing that gets forgotten about and/or breaks really easily. A better way to do it would be the option to do an update ONLY when the provisioning is performed and NOT when other playbooks are run. I'm wondering if I can use a 'smart' inventory based on the Satellite inventory without it wanting to update all the time. Either that or have two different Satellite inventories, with one being updated and used only for provisioning and the other only updated few hours for everything else.