Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
|
- ---
-
- - 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: wait for ssh port to be closed
- wait_for:
- host: "{{ ansible_host | default(inventory_hostname) }}"
- port: 22
- search_regex: OpenSSH
- timeout: "{{ reboot_wait_for_ssh_close_timeout_seconds }}"
- state: absent
- vars:
- ansible_connection: local
- register: _reboot_wait_for_ssh_port_closed
-
- - name: note the shutdown time
- set_fact:
- _reboot_shutdown_timestamp: "{{ _current_timestamp }}"
-
- - name: pause to let host reboot
- pause:
- seconds: "{{ reboot_pause_seconds }}"
- register: _reboot_pause
-
- - name: wait for ssh port to be open again
- wait_for:
- host: "{{ ansible_host | default(inventory_hostname) }}"
- port: 22
- search_regex: OpenSSH
- timeout: "{{ reboot_wait_for_ssh_open_timeout_seconds }}"
- state: present
- vars:
- ansible_connection: local
- register: _reboot_wait_for_ssh_port_open
-
- - import_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
|