osops-tools-generic/ansible/tasks/rolling-reboot.yaml

22 lines
785 B
YAML

---
- name: Rebooting Server
shell: sleep 2 && /sbin/shutdown -r now &
tags: reboot
- name: Waiting for port to go down from server reboot
wait_for: host={{ inventory_hostname }} port={{ reboot_check_port | default('22') }} timeout={{ wait_timeout | default('1200') }} state=stopped
connection: local
sudo: false
tags: reboot
- name: Waiting for port to come back after reboot
wait_for: host={{ inventory_hostname }} port={{ reboot_check_port | default('22') }} delay={{ wait_delay | default('120') }} timeout={{ wait_timeout | default('1200') }} state=started
connection: local
sudo: false
tags: reboot
- name: pausing to make sure host is fully booted
pause: minutes={{ pause_for_host_boot | default('3') }}
tags: reboot