source: main/waeup-ansible/playbook-reboot.yml @ 15334

Last change on this file since 15334 was 14763, checked in by uli, 7 years ago

Fix reboot playbook.

There were two problems with the former version of
this playbook which should be fixed now:

  • we do not restart virtual nodes (as their hosts are restarted already)
  • we act asyncronously when restarting machines

The latter led to predictable failures when rebooting
Ubuntu 16.04 machines. With 14.04, however, the
async: 0 setting worked fine.

File size: 888 bytes
RevLine 
[14185]1---
2# This ansible-playbook reboots productive
3# servers
4#
5# What it does:
6#   stop all services in need of manual stop
7#   then reboot
8#   then start all services in need of manual action.
9#
10# It will normally be run with ``ask-pass``
11#
12# Sample:
13#
[14434]14#   $ ansible-playbook -i hosts -K -l h5.waeup.org playbook-reboot.yml
[14185]15#
16
[14186]17- include: playbook-prep-reboot.yml
[14185]18
[14763]19- hosts: nonvirtual
[14185]20  become: yes
21  become_user: root
22  tasks:
23  - name: Restart machine
[14678]24    shell: sleep 2 && /sbin/shutdown -r now "Ansible triggered reboot"
[14763]25    async: 1
[14185]26    poll: 0
27    ignore_errors: true
28
29  - name: Wait for server to come back
30    become: no
31    local_action: wait_for
32                  host={{ inventory_hostname }}
[14187]33                  port=22
[14185]34                  state=started
35                  delay=30
36                  timeout=300
37                  connect_timeout=5
38
[14186]39- include: playbook-post-reboot.yml
Note: See TracBrowser for help on using the repository browser.