Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Hardware watchdog #11

Merged
merged 3 commits into from Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions ansible/site.yml
Expand Up @@ -111,6 +111,33 @@
shell: bash -c "source /root/.acme.sh/acme.sh.env; /root/.acme.sh/acme.sh --install-cert -d {{ acolock_hostname }} --key-file /etc/nginx/{{ acolock_hostname }}.key --fullchain-file /etc/nginx/{{ acolock_hostname }}.cer --reloadcmd \"systemctl reload nginx\""
tags: certificate

- name: Ensure Hardware Watchdog is enabled at boot
lineinfile:
path: /boot/config.txt
line: dtparam=watchdog=on
register: hw_watchdog

- name: Reboot the machine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idéalement on aimerait qu'il ne reboot que si la ligne au dessus a effectivement été ajoutée. C'est pas indispensable mais c'est plus agréable.

Il y a ce tuto par exemple qui explique comment faire : https://raymii.org/s/tutorials/Ansible_-_Only-do-something-if-another-action-changed.html.

reboot:
reboot_timeout: 3600
when: hw_watchdog.changed

- name: Ensure Watchdog package is installed
apt:
name: watchdog

- name: Write watchdog config
template:
src: watchdog.conf
dest: /etc/watchdog.conf

- name: Ensure Watchdog is enabled and started
service:
name: watchdog
state: started
enabled: yes


handlers:
- name: restart nginx
service:
Expand Down
3 changes: 3 additions & 0 deletions ansible/watchdog.conf
@@ -0,0 +1,3 @@
watchdog-device = /dev/watchdog
watchdog-timeout = 15
max-load-1 = 24