I thought over this yesterday evening, and was trying to figure out a way to do 
it with playbooks, and could not come to anything that made sense.  But I 
realized I was only looking at the problem from 1 angle.  ansible provides more 
than ansible-playbook, and in fact I think the only way to achieve this is to 
use the Ansible Python API, which ansible-playbook utilizes.

You could, probably with minimal changes, convert ansible-playbook, to loop 
it's execution of the playbook multiple times over the groups of an inventory.

Just some thoughts, but I am sure it could be done somewhat easily.  However 
without some additional work to log the tasks and such, it will really just 
look like you have run ansible-playbook multiple times.
-- 
Matt Martz
[email protected]

On January 22, 2014 at 4:26:23 PM, Jesse Keating ([email protected]) 
wrote:

Here's a fun scenario.  

Our inventory is divided up into multiple environments, that is when we  
execute our inventory plugin, we provide an ENV_NAME environment  
variable to tell the plugin which environment to load.  

Within each environment there are a number of logical groupings, we'll  
call these "cells". Each environment has 1 or more cell, and they get  
added semi-frequently so there isn't necessarily a hard coded list of  
them (although it is discoverable at run-time). My inventory plugin  
creates a group for each of those cells, that has other child-groups within.  

My need is to run a couple tasks. A torrent task and a stop torrent  
task. These tasks need to run in parallel within the cell, but serially  
through the list of cells. That is I have to torrent and then stop  
torrenting in cell1 before doing anything in cell2, and then cell3, etc...  

I'm looking for ways to express this in a playbook and falling short. I  
know I could use a shell script to loop over calling ansible-playbook  
providing a different --limit value each time but that feels inelegant.  

So I ask you, fellow Ansible users, do you have any ideas?  

-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 [email protected].  
To post to this group, send email to [email protected].  
For more options, visit https://groups.google.com/groups/opt_out.  

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to