From 0f9b5178b347eab2cfcebb65d994dc064bd57944 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 14 Mar 2023 14:10:26 +0100 Subject: [PATCH 1/2] Can parametrized watchdog --- defaults/main.yml | 3 +++ templates/watchdog-deb.conf.j2 | 2 +- templates/watchdog.conf.j2 | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8511d9a..b274db9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,6 @@ --- ssh_authorized_keys: [] ssh_authorized_keys_extra: [] + +watchdog_reboot_timer: 16 +watchdog_reset_timer: 10 diff --git a/templates/watchdog-deb.conf.j2 b/templates/watchdog-deb.conf.j2 index e893590..693eb64 100644 --- a/templates/watchdog-deb.conf.j2 +++ b/templates/watchdog-deb.conf.j2 @@ -29,7 +29,7 @@ #repair-maximum = 1 watchdog-device = /dev/watchdog -watchdog-timeout = 16 +watchdog-timeout = {{ watchdog_reboot_timer }} # Defaults compiled into the binary #temperature-sensor = diff --git a/templates/watchdog.conf.j2 b/templates/watchdog.conf.j2 index 0f896a5..8a5c8c6 100644 --- a/templates/watchdog.conf.j2 +++ b/templates/watchdog.conf.j2 @@ -1,2 +1,2 @@ -WATCHDOG_OPTS="-T 16 -t 10" +WATCHDOG_OPTS="-T {{ watchdog_reboot_timer }} -t {{ watchdog_reset_timer }}" WATCHDOG_DEV="/dev/watchdog" From 2f93186906609c2cf48a1ae2be3f0ab8d6826e40 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 14 Mar 2023 14:10:43 +0100 Subject: [PATCH 2/2] Include domain in inventory --- tasks/main.yml | 5 ++--- templates/hostname.j2 | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 287485b..e854ffc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,10 +20,9 @@ line: "{{ item.ip }} {{ item.hosts }}" with_items: - ip: "127.0.0.1" - hosts: "{{ inventory_hostname }}.{{ mydomain }} {{ inventory_hostname }} localhost localhost.localdomain" + hosts: "{{ inventory_hostname }} {{ inventory_hostname.split('.')[0] }} localhost localhost.localdomain" - ip: "::1" - hosts: "{{ inventory_hostname }}.{{ mydomain }} {{ inventory_hostname }} localhost localhost.localdomain" - when: mydomain is defined + hosts: "{{ inventory_hostname }} {{ inventory_hostname.split('.')[0] }} localhost localhost.localdomain" - import_tasks: "pkg_Alpine.yml" when: ansible_distribution == 'Alpine' diff --git a/templates/hostname.j2 b/templates/hostname.j2 index 1ee9db5..c2786e3 100644 --- a/templates/hostname.j2 +++ b/templates/hostname.j2 @@ -1 +1 @@ -{{ inventory_hostname }} \ No newline at end of file +{{ inventory_hostname.split(".")[0] }} \ No newline at end of file