refactor(configuration): extract shared BLS update task to reduce duplication

This commit is contained in:
2026-02-22 02:39:28 +01:00
parent f1af7ccbca
commit 3ddc3c72ed
3 changed files with 27 additions and 34 deletions

View File

@@ -253,25 +253,11 @@
mode: "0644"
content: "{{ configuration_kernel_cmdline_new }}\n"
- name: Find BLS entries for encryption kernel cmdline
- name: Update BLS entries with LUKS kernel cmdline
when: os_family == 'RedHat'
ansible.builtin.find:
paths: /mnt/boot/loader/entries
patterns: "*.conf"
register: configuration_kernel_bls_entries
changed_when: false
- name: Update BLS options with LUKS args
when:
- os_family == 'RedHat'
- configuration_kernel_bls_entries.files | length > 0
ansible.builtin.lineinfile:
path: "{{ item.path }}"
regexp: "^options "
line: "options {{ configuration_kernel_cmdline_new }}"
loop: "{{ configuration_kernel_bls_entries.files }}"
loop_control:
label: "{{ item.path }}"
vars:
_bls_cmdline: "{{ configuration_kernel_cmdline_new }}"
ansible.builtin.include_tasks: _bls_update.yml
- name: Read grub defaults
when: not os_family == 'RedHat'