diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..93f7dae --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +reboot_delay: 120 +reboot_timeout: 300 diff --git a/tasks/main.yml b/tasks/main.yml index e64e38d..897bb5e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,15 @@ --- - name: reboot - command: shutdown -r 1 + command: shutdown -r 30 async: 0 poll: 0 ignore_errors: true - name: wait for ssh - local_action: wait_for host={{ ansible_host | default(inventory_hostname) }} port=22 search_regex=OpenSSH delay={{ reboot_delay | default(120) }} state=started + local_action: wait_for host={{ ansible_host | default(inventory_hostname) }} port=22 search_regex=OpenSSH delay={{ reboot_delay }} timeout={{ reboot_timeout }} state=started + +- name: try to connect to ssh + setup: + retries: 10 + delay: 5