MrHeliose
MrHeliose

Reputation: 128

Ansible: wait for user action or timeout

How can I wait for 30sec OR a user interaction in Ansible?

I have the following playbook at the moment:

 - name: "Test"
   hosts: localhost
   tasks:    
     - name: wait
       wait_for:
         timeout: 30

but you can't press return to cancel the waiting time.

I also have unsuccessfully try the following solution:

 - name: "Test"
   hosts: localhost
   tasks:    
     - name: wait
       wait_for:
         pause:
         prompt: Press return to continue. Press Ctrl+c and then "a" to abort
         timeout: 30

but pause is not a valide option for wait_for.

Upvotes: 0

Views: 727

Answers (1)

Frenchy
Frenchy

Reputation: 17035

the documentation says:

You can use ctrl+c if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely. To continue early press ctrl+c and then c. To abort a playbook press ctrl+c and then a.

Upvotes: 1

Related Questions