You have to restructure the playbooks to loop within the role itself 
(perhaps have a list with versions to install in your variables), or call 
the role twice.  I would really like to see some mechanism to loop over a 
role, but with that said, you should be able to find a solution.

Why is calling the role twice not acceptable? I have a playbook that calls 
a role in 50 different ways, depending on how it's executed. While it's a 
bit long, it is structured simply, and easily understood.

I had similar decisions to make, and looping within the role wasn't 
something I was happy with, so I ended up applying the role multiple times, 
which really isn't all that painful IMO.  My problems with looping within 
the role (for my use case) was that I needed to use with_items for many 
tasks, which led to added complexity of the playbook - I understood 
perfectly what was required and being performed, but collaboration with 
other folks at my organization that are new to Ansible would prove 
difficult. 


On Tuesday, March 25, 2014 6:04:19 AM UTC-5, Prune wrote:
>
> For me the use case is : 
>
> - I have a playbook that installs elasticsearch using a role
> - elasticsearch version is defined in the host file as a variable along 
> each server name
> - I have a group with all the hosts needing elasticsearch
>
> Until then, we were using elasticsearch 0.90.x (x is 2,3 or 9).
> Now, I need to install BOTH the 0.90.x and the new 1.0.1 version at the 
> same time.
> While the playbook can handle that, I can't find a way to have the role 
> played twice, once for each version ?
> The only solution so far is calling the role twice and statically setting 
> the version on each call, which is not acceptable.
>
> One solution would be to call the role using a with_item statement to have 
> it run for every version is defined in a dict... but this is deprecated....
> Any clue ? 
>
>
> Thanks.
>
> Prune
>

-- 
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/3dae1e0d-38a3-497e-a72a-67d8a85f64d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to