-2

I have an Ansible playbook command, which is to set up a k8s cluster, but it fails sometime, as some dependent pieces are not quick enough to be ready, for its follow-ups.

So instead, I am think to have this command execute step by step, something as if:

yes | ansible-playbook ... --step 

but how may I have a delay, in between each step execution during which. Thanks,

Jack

U880D
  • 8,601
  • 6
  • 24
  • 40
user3595231
  • 711
  • 12
  • 29
  • 2
    what have you tried so far? is it failing? have you looked into Ansible's module `wait_for` or `pause`? – Carlos Monroy Nieblas Nov 29 '22 at 23:47
  • Thanks for the response. It is a fairly complicated job, that contains lots of tasks, I have not figured out a way to use these settings. So is there a way doing it on command line level ? – user3595231 Nov 30 '22 at 00:09

1 Answers1

0

Regarding

How to do a step sleep in the ansible-playbook execution? ... I have not figured out a way to use these settings. ...

You may have a look into pause module and following example

- name: Make sure service has time to start or stop
      pause:
        seconds: 60
      when: not ansible_check_mode

I am think to have this command execute step by step ...

Or in other words task by task. Therefore you may have a look into Tags as with them one will have the capability to execute single tasks or groups of tasks, depending on tags used.

Further Q&A


Regarding --step and

... in between each step execution during which ...

please take note that Step mode is mentioned to Executing playbooks for troubleshooting

With this option, Ansible stops on each task, and asks if it should execute that task.

Regarding

... but how may I have a delay ...

There is already a delay in that approach, the user. Since the next task will only execute if the user press yes.

U880D
  • 8,601
  • 6
  • 24
  • 40