ansible/playbooks/host_reboot.yml

28 lines
826 B
YAML
Raw Normal View History

# requires --extra-vars="target=hostspec"
- name: reboot hosts
hosts: "{{ target }}"
gather_facts: False
user: root
serial: 1
tasks:
2012-12-12 21:31:56 +00:00
- 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
2012-12-12 04:43:49 +00:00
2014-09-30 16:48:50 +00:00
- name: reboot the host
command: /sbin/shutdown -r 1
2012-12-12 04:43:49 +00:00
2014-09-30 16:48:50 +00:00
- 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
2014-09-30 16:48:50 +00:00
- name: sync time
2015-08-31 16:35:06 +00:00
command: ntpdate -u 1.rhel.pool.ntp.org
2014-09-30 16:48:50 +00:00
- name: tell nagios to unshush
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
delegate_to: noc01.iad2.fedoraproject.org
2014-09-30 16:48:50 +00:00
ignore_errors: true