Thanks for suggestion, it looks like i can find a solution with that method.
I would like to pass just count, a number, how can i do that?

On Thursday, July 10, 2014 4:54:05 PM UTC+2, James Cammarata wrote:
>
> The other way we typically recommend doing this is to pass the array of 
> whatever as a role parameter. For example:
>
>   roles:
>   - { role: foo, list_of_whatever: [...] }
>
> and then loop over that list_of_whatever variable inside the roles tasks.
>
>
> On Thu, Jul 10, 2014 at 7:27 AM, Michael DeHaan <[email protected] 
> <javascript:>> wrote:
>
>> "you cannot execute a role conditionally, you CAN pass a condition to 
>> every task in a role."
>>
>> True!
>>
>> - { role:  asdf, when: foo == 'asdf' }
>>
>> Another good trick is group_by is a great way to create a small group of 
>> hosts where a given condition is true or false, and then you just apply 
>> that role to that group.
>>
>> - hosts: all
>>   tasks:
>>       - group_by: key=foo_{{ foo }}
>>
>> # talk to all hosts where the value of foo is asdf
>> - hosts: foo_asdf
>>   roles:
>>      - asdf
>>
>>
>>
>>  
>>
>> On Thu, Jul 10, 2014 at 7:26 AM, Brian Coca <[email protected] 
>> <javascript:>> wrote:
>>
>>> you cannot execute a role conditionally, you CAN pass a condition to 
>>> every task in a role.
>>>
>>> role and include directives are basically 'preprocessing macros' they 
>>> are used to include other files into main play.
>>> ​
>>>
>>> -- 
>>> 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] <javascript:>.
>>> To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/CADn%2BHsz6YvdjD1QvrKAP-Pg_yE%2BOmeFKEgAeMGJXVVcy6_oZ-Q%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/CADn%2BHsz6YvdjD1QvrKAP-Pg_yE%2BOmeFKEgAeMGJXVVcy6_oZ-Q%40mail.gmail.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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgz2jVy-S%3DDK7NHWty7OV%2BZf2bgr9%2Bgx1Am3qTMrHA504g%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgz2jVy-S%3DDK7NHWty7OV%2BZf2bgr9%2Bgx1Am3qTMrHA504g%40mail.gmail.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/3a3e4978-ecea-45fc-bc33-21bbec7d9007%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to