theforeman / foreman_ansible_inventory

Foreman dynamic inventory script for ansible - Now merged into Ansible itself
GNU General Public License v3.0
70 stars 31 forks source link

Specify a static filename for the cache files #47

Closed joeyloman closed 7 years ago

joeyloman commented 7 years ago

With this patch it's possible to specify a static filename for the cache files. This is handy if the dynamic inventory script is used in Ansible Tower. Every time Ansible Tower updates the dynamic inventory it creates and executes a generated temporary script filename. Because it's different every time you get different cache files and can't use the cache.

I added the filename parameter to the the configuration file under the cache section. If the filename parameter isn't specified in the configuration file it uses the original filename.

Maybe this patch is also useful for other users? Feel free to merge it.

agx commented 7 years ago

@joeyloman LGTM. Note that this hook also lives in upstream ansible so you might want to submit it there as well.

agx commented 7 years ago

@joeyloman Pushed with a slight tweak to the commit message