aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/common/handlers/main.yml
blob: 95600681ee570601cafc63d52b7a04e285207f5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- name: Reboot
  reboot:
  args:
    # On my trusty old Raspberry Pi 1 Model B+, /proc/sys/kernel/random/boot_id
    # can sometimes stay the same between reboots. Apparently, not enough
    # entropy or something.
    boot_time_command: uptime -s
    # Another option is `who -s`. This option requires Ansible 2.10 or later.

    # 5 minutes is plenty.
    reboot_timeout: 300
  # Don't reboot yourself accidentally:
  when: 'ansible_env["SSH_CLIENT"].split()[0] not in ansible_all_ipv4_addresses'
  become: yes
  listen: reboot

- name: Wait for connectivity
  # One of the nodes is the VPN server connecting all the other nodes, wait
  # until all of them are back up:
  wait_for_connection:
  args:
    # 5 minutes is plenty.
    timeout: 300
  listen: reboot