2013-03-04 22:37:13 +00:00
|
|
|
# requires --extra-vars="target=hostspec"
|
2012-12-11 21:59:32 +00:00
|
|
|
|
|
|
|
|
- name: reboot hosts
|
2013-12-20 01:17:06 +00:00
|
|
|
hosts: "{{ target }}"
|
|
|
|
|
gather_facts: False
|
2012-12-11 21:59:32 +00:00
|
|
|
user: root
|
2012-12-14 03:52:07 +00:00
|
|
|
serial: 1
|
2012-12-11 21:59:32 +00:00
|
|
|
|
|
|
|
|
tasks:
|
2012-12-12 21:31:56 +00:00
|
|
|
- name: tell nagios to shush
|
2013-12-20 01:17:06 +00:00
|
|
|
nagios: action=downtime minutes=60 service=host host={{ inventory_hostname }}
|
2012-12-12 21:28:12 +00:00
|
|
|
delegate_to: noc01.phx2.fedoraproject.org
|
2013-12-20 01:17:06 +00:00
|
|
|
ignore_errors: true
|
2012-12-12 04:43:49 +00:00
|
|
|
|
2013-12-20 01:17:06 +00:00
|
|
|
- name: reboot the virthost
|
|
|
|
|
command: /sbin/reboot
|
2012-12-11 21:59:32 +00:00
|
|
|
|
2012-12-11 22:09:42 +00:00
|
|
|
- name: wait for host to come back - up to 6 minutes
|
2013-12-20 01:17:06 +00:00
|
|
|
local_action: wait_for host={{ target }} port=22 delay=120 timeout=420
|
2012-12-11 21:59:32 +00:00
|
|
|
|
2013-12-20 01:17:06 +00:00
|
|
|
|
|
|
|
|
# - name: see if it needs to be rebooted
|
|
|
|
|
# action: command /usr/local/bin/needs-reboot.py
|
|
|
|
|
# register: needsreboot
|
|
|
|
|
|
|
|
|
|
# - name: tell nagios to shush
|
|
|
|
|
# action: nagios action=silence host=${inventory_hostname_short}
|
|
|
|
|
# delegate_to: noc01.phx2.fedoraproject.org
|
|
|
|
|
# when:"'yes' in needsreboot.stdout"
|
|
|
|
|
|
|
|
|
|
# - name: reboot the host
|
|
|
|
|
# action: command /sbin/reboot
|
|
|
|
|
# when:"'yes' in needsreboot.stdout"
|
|
|
|
|
|
|
|
|
|
# - name: wait for host to come back - up to 6 minutes
|
|
|
|
|
# local_action: wait_for host=${inventory_hostname} port=22 delay=30 timeout=420
|
|
|
|
|
# when:"'yes' in needsreboot.stdout"
|
|
|
|
|
|
|
|
|
|
# - name: tell nagios to unshush
|
|
|
|
|
# action: nagios action=unsilence host=${inventory_hostname_short}
|
|
|
|
|
# delegate_to: noc01.phx2.fedoraproject.org
|
|
|
|
|
# when:"'yes' in needsreboot.stdout"
|
2012-12-12 04:43:49 +00:00
|
|
|
|
2012-12-11 21:59:32 +00:00
|
|
|
|
|
|
|
|
|