Files
fedora-infra_ansible/playbooks/host_reboot.yml
2024-11-25 19:04:25 +10:00

29 lines
832 B
YAML

# requires --extra-vars="target=hostspec"
---
- name: reboot hosts
hosts: "{{ target }}"
gather_facts: false
user: root
serial: 1
tasks:
- name: tell nagios to shush
nagios: action=downtime minutes=60 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.iad2.fedoraproject.org
ignore_errors: true
- name: reboot the host
command: /sbin/shutdown -r 1
- name: wait for host to come back - up to 15 minutes
local_action: wait_for host={{ target }} port=22 delay=120 timeout=900 search_regex=OpenSSH
# - name: sync time
# command: ntpdate -u 1.rhel.pool.ntp.org
- name: tell nagios to unshush
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.iad2.fedoraproject.org
ignore_errors: true