refactor ♻️: Refactor kernel panic configuration with ansible.posix.sysctl for better management and readability
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 12s
Gitleaks Scan / gitleaks (push) Successful in 7s
Markdown Lint / markdown-lint (push) Successful in 4s

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.
This commit is contained in:
2026-02-15 08:36:22 +01:00
parent 059ea94842
commit 4ea7833055

View File

@@ -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' }