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