variable for list of targetted hosts

32 views
Skip to first unread message

jocelyn gibart

unread,
Mar 18, 2016, 4:00:15 PM3/18/16
to Ansible Project
Hello dear Ansible wizards

Is there a way to get the list of targetted hosts for a playbook or for a role ?

I didnt find any variable or any way to get this.

What I'm looking for is not merely the hosts: value, it is the intersection of hosts values and -l ( --limit ) option.

Thank you 

Arthur Reyes

unread,
Mar 18, 2016, 4:04:36 PM3/18/16
to Ansible Project
$ ansible -i INVENTORY all -m setup --limit vm04 --list-hosts

Brian Coca

unread,
Mar 18, 2016, 4:27:03 PM3/18/16
to ansible...@googlegroups.com
the play_hosts var should have that list (unless you are using serial, which limits it per batch)

--
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/454039d3-8ba2-40c9-b47f-b45bae0a1246%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



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

jocelyn gibart

unread,
Mar 21, 2016, 4:43:31 AM3/21/16
to Ansible Project
Yes,it is working, thanks.
This is exactly what I was looking for.
Reply all
Reply to author
Forward
0 new messages