aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/roles/common/handlers
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-31 23:44:54 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-31 23:44:54 +0200
commit727ab17a644d52105746e18c301cf733b1181507 (patch)
tree71113c6efae3074899de965aee5489cb76362f8e /src/roles/common/handlers
parentdowngrade Ansible (diff)
downloadmaintenance-727ab17a644d52105746e18c301cf733b1181507.tar.gz
maintenance-727ab17a644d52105746e18c301cf733b1181507.zip
move Ansible files to src/
Diffstat (limited to 'src/roles/common/handlers')
-rw-r--r--src/roles/common/handlers/main.yml24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/roles/common/handlers/main.yml b/src/roles/common/handlers/main.yml
new file mode 100644
index 0000000..4942957
--- /dev/null
+++ b/src/roles/common/handlers/main.yml
@@ -0,0 +1,24 @@
+- name: Reboot
+ ansible.builtin.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: true
+ 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:
+ ansible.builtin.wait_for_connection:
+ args:
+ # 5 minutes is plenty.
+ timeout: 300
+ listen: reboot