Options for filtering hosts

25 views
Skip to first unread message

S C Rigler

unread,
Jan 23, 2019, 8:40:44 AM1/23/19
to ansible...@googlegroups.com
We have a static inventory where hosts are grouped by location and
purpose. I was wondering if there was a way to limit a playbook run
to hosts based on cached facts as a criteria (like only run on rhel 7
hosts, or only run on virtual hosts, etc). I know I can put the tasks
in a block with a "when" clause to have it only run on hosts that
match the criteria, but it still has to iterate through every host to
decide which to include (which isn't efficient with a large inventory
where only 10% of the hosts might match the criteria). Any
suggestions?

Thanks,
Steve

Adam E

unread,
Jan 23, 2019, 11:57:47 AM1/23/19
to Ansible Project
If you happen to be using awx, you can enable fact caching and then create a dynamic inventory which can be based on search results including facts values
Reply all
Reply to author
Forward
0 new messages