From 059ea94842ab35a5d3b52c51fb0d54c61ef1394b Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 15 Feb 2026 08:30:32 +0100 Subject: [PATCH 1/3] =?UTF-8?q?feat=20=E2=9C=A8:=20Add=20task=20to=20confi?= =?UTF-8?q?gure=20kernel=20panic=20behavior=20and=20auto-reboot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces two new tasks in the `kernel.yml` file: one to configure the kernel panic behavior and another for enabling automatic reboot on kernel panic. These enhancements improve system reliability by ensuring that the system can recover from critical errors more effectively. --- tasks/kernel.yml | 18 ++++++++++++++++++ tasks/main.yml | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 tasks/kernel.yml diff --git a/tasks/kernel.yml b/tasks/kernel.yml new file mode 100644 index 0000000..d8a23c5 --- /dev/null +++ b/tasks/kernel.yml @@ -0,0 +1,18 @@ +--- +# ------------------------------------------------- +# Configure kernel panic behavior +# ------------------------------------------------- +- name: kernel | Configure kernel panic auto-reboot + ansible.builtin.copy: + dest: /etc/sysctl.d/99-kernelpanic.conf + content: | + kernel.panic = 10 + kernel.panic_on_oops = 1 + owner: root + group: root + mode: '0644' + +- name: kernel | Apply kernel panic settings + ansible.builtin.command: + cmd: sysctl -p /etc/sysctl.d/99-kernelpanic.conf + become: true diff --git a/tasks/main.yml b/tasks/main.yml index b00e094..3793255 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,3 +36,6 @@ - name: Install powertop, auto-tune, and make it persistent ansible.builtin.import_tasks: powertop.yml + +- name: kernel panic auto-reboot + ansible.builtin.import_tasks: kernel.yml From 4ea7833055599ef57d4cb831fd9ee6baf4adb323 Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 15 Feb 2026 08:36:22 +0100 Subject: [PATCH 2/3] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor?= =?UTF-8?q?=20kernel=20panic=20configuration=20with=20ansible.posix.sysctl?= =?UTF-8?q?=20for=20better=20management=20and=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactoring involves updating the kernel panic configuration management to utilize the `ansible.posix.sysctl` module. This change enhances the clarity and maintainability of the code by providing a more structured approach to handling system settings. --- tasks/kernel.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tasks/kernel.yml b/tasks/kernel.yml index d8a23c5..de7fe63 100644 --- a/tasks/kernel.yml +++ b/tasks/kernel.yml @@ -3,16 +3,12 @@ # Configure kernel panic behavior # ------------------------------------------------- - name: kernel | Configure kernel panic auto-reboot - ansible.builtin.copy: - dest: /etc/sysctl.d/99-kernelpanic.conf - content: | - kernel.panic = 10 - kernel.panic_on_oops = 1 - owner: root - group: root - mode: '0644' - -- name: kernel | Apply kernel panic settings - ansible.builtin.command: - cmd: sysctl -p /etc/sysctl.d/99-kernelpanic.conf - become: true + ansible.posix.sysctl: + name: "{{ item.key }}" + value: "{{ item.value }}" + state: present + sysctl_file: /etc/sysctl.d/99-kernelpanic.conf + reload: yes + loop: + - { key: 'kernel.panic', value: '10' } + - { key: 'kernel.panic_on_oops', value: '1' } From 775d9969116f1369342a90612721599ce0864658 Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 15 Feb 2026 08:37:46 +0100 Subject: [PATCH 3/3] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Rename=20t?= =?UTF-8?q?ask=20from=20'kernel=20panic=20auto-reboot'=20to=20'Configure?= =?UTF-8?q?=20kernel=20panic=20auto-reboot'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored the task name to improve clarity and consistency. This change enhances readability and makes it easier for developers to understand the purpose of the task. --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3793255..712fcb4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,5 +37,5 @@ - name: Install powertop, auto-tune, and make it persistent ansible.builtin.import_tasks: powertop.yml -- name: kernel panic auto-reboot +- name: Configure kernel panic auto-reboot ansible.builtin.import_tasks: kernel.yml