Define group in hosts file based on intersection of 2 groups

363 views
Skip to first unread message

Iain M. Conochie

unread,
Sep 1, 2016, 11:54:18 AM9/1/16
to ansible...@googlegroups.com
Hello,

It is possible to limit the hosts the ansible command runs against by specifying patterns on the command line like so:

ansible webservers:!staging -m ping

Is it possible to use the same technique to define groups in the inventory file, so that the new group is defined by the intersection of 2 child groups?

Thanks

Iain

Brian Coca

unread,
Sep 20, 2016, 11:20:59 AM9/20/16
to ansible...@googlegroups.com
No, that is only available in the `hosts:` clause of a play, with --limit and for `ansible` in the host pattern specified (equivalent to `hosts:` in a play).


----------
Brian Coca

Raj

unread,
Aug 15, 2017, 11:43:50 AM8/15/17
to Ansible Project, ia...@shihad.org
That should be possible.
I have been doing something like that using the escape character in command line. Ansible version 2.3
ansible webserver:\&dev -m ping
ansible webserver:\!prod -m ping

Thanks.
Reply all
Reply to author
Forward
0 new messages