On 21.09.2016 14:09, Krist van Besien wrote:
On Monday, September 19, 2016 at 9:21:25 PM UTC+2, Kai Stian Olstad wrote:


On 17. sep. 2016 14:41, Krist van Besien wrote:
> Hi all,
>
> In one of my playbooks I need to build in a fairly long pause.
>
> So I have this task:
>
> - name: Pause for 20 minutes
>   pause: minutes=20
>
> This works, but has the disadvantage that for 20 minutes nothing appears
to
> happen on the screen. I would like to give a bit of feedback. Like a
> message "still waiting, x minutes to go" every 30 seconds or so. What
would
> be the best way to do this?

It's not pretty, but it gives a feedback every 30 seconds.

   - name: Pause
     pause:
       seconds=30
     with_sequence: start=40 end=0 stride=-1


That works. But this is indeed not that pretty. Is there a way to get rid
of the prompt?

No.


I think I might in stead create a loop that just executes "sleep 30"...

This is a solution that looks nice, the downside is it does 40 includes and creates 40 dummy tasks.


pause.yml
---
- name: "{{ item | int / 2 }} minutes left"
  command: sleep 30
  changed_when: false


In the playbook:

  - include: pause.yml
    with_sequence: start=40 end=1 stride=-1


--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20bb7a431cbf94c17bff97a14a70d7a0%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to