I think you look for this:

http://docs.ansible.com/playbooks_loops.html#looping-over-a-list-with-an-index


On 23 January 2014 11:12, Julien Tognazzi <[email protected]> wrote:

> Hi list,
>
> Is there a way to have a counter with the with_items loop ?
>
> The idea would be to create several cron job not starting all at the same
> time.
>
> tasks:
>   - name: "Install some cron jobs"
>     cron: name="job {{ item }}" min="COUNTER??" hour="3" user=root
> cron_file="myjobs" job="/path/to/some/script {{ item }}"
>     with_items: somelist
>
> the result could look like so:
>
> #Ansible: job item1
> 1 3 * * * root /path/to/some/script item1
> #Ansible: job item2
> 2 3 * * * root /path/to/some/script item2
> #Ansible: job item3
> 3 3 * * * root /path/to/some/script item3
>
> any suggesstions ?
>
> Many thanks,
>
> Julien.
>
> --
> 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