Hi Alexander,

I don't think "with_items" is the way to go here - if I use "with_items", 
it's going to try to execute on all of the hosts at once, unless it can be 
used in a method that I haven't thought of.

On Thursday, November 26, 2015 at 12:44:45 AM UTC-5, Alexander Artemenko 
wrote:
>
> Roger, did you try to use "with_items" (
> http://docs.ansible.com/ansible/playbooks_loops.html#standard-loops)?
>
> среда, 25 ноября 2015 г., 22:24:02 UTC+3 пользователь Roger Sherman 
> написал:
>>
>> I'm working on a playbook, that will be deploying a java app to four 
>> hosts. I want it to push the app out to each node, making sure the correct 
>> directories exist to push the new version to - that's the easy part, and it 
>> can do all four of the nodes at once, no issue there. But then I want it to 
>> loop through the list of hosts, taking them out of the load balancer, 
>> changing the app version that is linked on each node, and then put them 
>> back into the load balancer, one at a time. All of the tasks are easily 
>> enough performed, but the looping part I'm not sure about. I've googled 
>> looping through hosts, but mainly I'm finding articles on how to loop 
>> through hosts in a template.
>>
>> Is it possible to run through hosts in a loop as a task, or 
>> alternatively, can the tasks be run from a template? I suppose I could just 
>> set the whole playbook to do just one host at a time (serial: 1), or do 
>> multiple ansible runs, limiting the run to one host at a time, but that 
>> seems a bit inelegant - it seems like the tasks that can safely be run in 
>> parallel should be, and the tasks that can't should be looped. Am I 
>> overthinking this?
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5eaa4282-6d54-4e86-a0ca-cb7049ba29e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to