On Tue, 03 Feb 2015 23:25 -0800, Tzach Livyatan
<[email protected]> wrote:
> Hello again
> I have a command to execute X times, pausing for a few second after each 
> iteration.
> One (working) way to do it is:
>     - shell: sleep 60; the-command
>       with_sequence: count={{X}}
> 
>  But its look ugly to me:
> - does not use built-in pause command
> - make each of the host iterate independently, which may cause sync issue
>  
> I would like to do something like (not legal)
>     - shell: the-command
>       action: pause: seconds=60
>       with_sequence: count={{X}}
> Using include for the two tasks didnt work either as include and
> with_items 
> is deprecated.
> 
> What is the right solution in this case?

I think your initial solution is the cleanest way to do this right now.

I was thinking if the shell module could be enhanced to accept a pause
parameter, but I don't know how Ansible "unroll" the list of activities
that should be carried out when there is looping involved. The module
might not even know it's going to run multiple times (so then it
couldn't pause anything, because it'd think it's running just once).

If that's the case, then perhaps the looping construct(s) would have to
accept a pause parameter. 

Perhaps something like the concept of "blocks" [1] being worked on in v2
might help your situation. Create a block with a shell and a pause task
and iterate over them.

[1] -
https://groups.google.com/d/msg/ansible-project/4IXdJqzhuM8/aGIJglZ8G_4J

Giovanni

-- 
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/1423047263.4066176.222930137.04FE27E8%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to