refactor(configuration): simplify grub commandline variable assembly
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
block:
|
||||
- name: Build RHEL kernel command line defaults
|
||||
vars:
|
||||
configuration_grub_root_uuid_value: >-
|
||||
grub_root_uuid: >-
|
||||
{{
|
||||
(
|
||||
partitioning_main_uuid.stdout
|
||||
@@ -26,7 +26,7 @@
|
||||
| default('')
|
||||
| trim
|
||||
}}
|
||||
configuration_grub_lvm_args_value: >-
|
||||
grub_lvm_args: >-
|
||||
{{
|
||||
(
|
||||
['rd.lvm.lv=sys/root']
|
||||
@@ -39,27 +39,27 @@
|
||||
if (filesystem | lower) != 'btrfs'
|
||||
else []
|
||||
}}
|
||||
configuration_grub_root_flags_value: >-
|
||||
grub_root_flags: >-
|
||||
{{ ['rootflags=subvol=@'] if (filesystem | lower) == 'btrfs' else [] }}
|
||||
configuration_grub_cmdline_linux_base_value: >-
|
||||
grub_cmdline_linux_base: >-
|
||||
{{
|
||||
(['crashkernel=auto'] + configuration_grub_lvm_args_value)
|
||||
(['crashkernel=auto'] + grub_lvm_args)
|
||||
| join(' ')
|
||||
}}
|
||||
configuration_grub_kernel_cmdline_base_value: >-
|
||||
grub_kernel_cmdline_base: >-
|
||||
{{
|
||||
(
|
||||
(['root=UUID=' + configuration_grub_root_uuid_value]
|
||||
if configuration_grub_root_uuid_value | length > 0 else [])
|
||||
(['root=UUID=' + grub_root_uuid]
|
||||
if grub_root_uuid | length > 0 else [])
|
||||
+ ['ro', 'crashkernel=auto']
|
||||
+ configuration_grub_lvm_args_value
|
||||
+ configuration_grub_root_flags_value
|
||||
+ grub_lvm_args
|
||||
+ grub_root_flags
|
||||
)
|
||||
| join(' ')
|
||||
}}
|
||||
ansible.builtin.set_fact:
|
||||
configuration_grub_cmdline_linux_base: "{{ configuration_grub_cmdline_linux_base_value }}"
|
||||
configuration_kernel_cmdline_base: "{{ configuration_grub_kernel_cmdline_base_value }}"
|
||||
configuration_grub_cmdline_linux_base: "{{ grub_cmdline_linux_base }}"
|
||||
configuration_kernel_cmdline_base: "{{ grub_kernel_cmdline_base }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Check if grub defaults file exists
|
||||
|
||||
Reference in New Issue
Block a user