On 2/3/14, 6:58 PM, Ed Zarecor wrote:
Is there a way to access the play.hosts from my play?

I would like to be able to do:

- hosts:
tag_role_cluster_host:&tag_environment_staging:&tag_deployment_us_east

and then use the host list generated by that set intersection to
configure each of hosts with the complete list of it's peers.

So that in a jinja template I could do something like:

{%- for host in play_hosts -%}
   cluster-add-host {{ host }}
{%- endfor %}

I have other ways of accomplishing this, but they are not a clean as
this and given that plays already provide set operators, I'd like to
take advantage of them.


hostvars.keys() will give you all the hosts for a given play.


-jlk

--
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to