Is there a simple way to find host groups for a role?

32 views
Skip to first unread message

Sergey Maslyakov

unread,
Aug 6, 2015, 8:34:04 AM8/6/15
to Ansible Project
Given an Ansible playbook, is there a simple way to list out all host groups that a given roles belongs to?

My roles install applications using RPMs. If there is a fix in an application, I need to know what servers I should update.


Thank you,
/Sergey

Greg DeKoenigsberg

unread,
Aug 6, 2015, 11:04:14 AM8/6/15
to Ansible Project

--list-hosts option is what you want.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/adc6310c-5d3e-4bf9-9938-7ae50b04b75b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Greg Kedge

unread,
Nov 9, 2015, 11:07:31 AM11/9/15
to Ansible Project
It isn't I am not seeing --limit working conjunction with --list-hosts 2.0.beta as it did in 1.9.  I was search through here is to see if others were making the same observation.

E.g.: This provides all hosts in an inventory without the requested limit:
ansible -i inventory --limit [group|host] --list-hosts all
If limiting is of interest, --list-hosts had and continues to exhibit limiting behavior. Just now, it is the required way to limit.
ansible -i inventory --list-hosts [group|host]
This is a much more succinct, but may break existing expectations.
Reply all
Reply to author
Forward
0 new messages