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

Support for skip_host_patterns #44

Closed joeyloman closed 7 years ago

joeyloman commented 7 years ago

This contains a patch for excluding hosts in the inventory using the skip_host_patterns option.

My usecase for this is to exclude hosts which are added by virt-who (VMware ESX servers) and the Foreman host itself. Maybe it's also handy for other use cases.

agx commented 7 years ago

@joeyloman Thanks for the patch. I wonder if this is really needed since you can limit things in ansible nicely but if we add this we should IMHO

joeyloman commented 7 years ago

Thanks for the quick response. You are right about limiting things in Ansible. But virt-who adds every machine twice in Foreman with a prefix and an id. So my inventory contains half count of useless hosts. In a large environment this can be undesirable.

I understand your suggestion about seperate the filtering and the regex support, it's nicer. Would you still be interested in merging a correct patch as you suggested?

agx commented 7 years ago

@joeyloman I'm fine with a unintrusive patch that filter by regex Guess it can be handy in some situations.

joeyloman commented 7 years ago

Ok cool! I'll get back on this when I have time to do this and submit a new patch.