Closed joeyloman closed 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
filtered_hosts = [ h for h in self._get_hosts() if filter_host(h) ]
for host in filtered_hosts:
...
This will keep the filtering nicely in one location.
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?
@joeyloman I'm fine with a unintrusive patch that filter by regex Guess it can be handy in some situations.
Ok cool! I'll get back on this when I have time to do this and submit a new patch.
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.