"In a task, I am trying to figure out how I can loop over the items of a list that is defined as a host variable for each host in a specific group."
If the variable is "listvar" with_items: listvar On Mon, Apr 28, 2014 at 3:37 PM, 'Petros Moisiadis' via Ansible Project < [email protected]> wrote: > On 04/28/2014 09:56 PM, Adam Morris wrote: > > > > On Monday, April 28, 2014 10:35:15 AM UTC-7, Ernest0x wrote: >> >> In a task, I am trying to figure out how I can loop over the items of a >> list that is defined as a host variable for each host in a specific >> group. >> > > I'm not sure what you are trying to do here so I can't offer too much > advice. It also depends on what you are planning on doing with those > variables I suspect. > > > Given the example I wrote in my previous post, what I want is simply to > have the task run for each item in "mylist" for each host in "somegroup". > Thus, have the task run for 5 times: for item1, item2, item3, item4 and > item5. > > > You might want to look at this > http://docs.ansible.com/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts > > Normally I only need to iterate over a list of variables for the current > host. But there are examples of accessing variables for groups of hosts on > that page. > > > I already know about these 'magic' vars. The difficulty is not on how to > get the data, but on how to construct the loop so that I get the iteration > I want. > > > Adam > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/26c8f5ac-db7c-4171-8c7c-0f9605a212d4%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/26c8f5ac-db7c-4171-8c7c-0f9605a212d4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/535EADE1.40309%40yahoo.gr<https://groups.google.com/d/msgid/ansible-project/535EADE1.40309%40yahoo.gr?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwx9Ne97ckJOmvJQb4rgCPQX3agQjC2AuQXdeJQAdwJ%2BQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
