You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- ---
-
- - name: reboot
- command:
- systemd-run --on-active={{reboot_command_after_seconds}}
- shutdown -r now "Reboot triggered by Ansible script"
- #async: 1
- #poll: 0
- #ignore_errors: true
- when: reboot_command
-
- - name: let server reboot
- pause:
- seconds: "{{ reboot_pause_seconds }}"
-
- - name: wait for ssh port
- wait_for:
- host: "{{ ansible_host | default(inventory_hostname) }}"
- port: 22
- search_regex: OpenSSH
- timeout: "{{ reboot_wait_timeout_seconds }}"
- vars:
- ansible_connection: local
-
- - include_role:
- name: ssh_host_key
-
- - name: try to connect to ssh
- setup:
-
- - name: check uptime for successful reboot
- set_fact:
- reboot_uptime: "{{ ansible_uptime_seconds }}"
- failed_when: ansible_uptime_seconds > reboot_uptime_max_seconds
|