Wednesday, 14 August 2019

Asynchronous actions and Polling in Ansiable by Raj Gupta



[ansible@ip-172-31-80-19 ~]$ vi playbook100.yml
[ansible@ip-172-31-80-19 ~]$ cat playbook100.yml
-
  name: "this is our first playbook."
  hosts: all
  tasks:
    -
      name: 'sleep for 120 sec'
      command: sleep 120
    -
      name: 'second task'
      command: touch /tmp/secound_task.txt
[ansible@ip-172-31-80-19 ~]$


-----------------------------------------------------------------------------------------------------------------


This will sleep for 60 sec then at 70 sec it will going to check ssh connection then after 70+35=105 sec it wail going to check then 105+35 so on

[ansible@ip-172-31-80-19 ~]$ vi playbook100.yml
[ansible@ip-172-31-80-19 ~]$ cat playbook100.yml
-
  name: "this is our first playbook."
  hosts: all
  tasks:
    -
      name: 'sleep for 60 sec'
      command: sleep 60
      async: 70
      poll: 35
    -
      name: 'second task'
      command: touch /tmp/secound_task.txt
[ansible@ip-172-31-80-19 ~]$



No comments:

Post a Comment