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/62291520-6f0a-4520-a682-4fbdd57b23a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to