refactor ♻️: Refactor kernel panic configuration with ansible.posix.sysctl for better management and readability
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:
@@ -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' }
|
||||
|
||||
Reference in New Issue
Block a user