File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1578,8 +1578,21 @@ Part of the grub2_bootloader_argument_absent template.
15781578- name: Update grub defaults and the bootloader menu
15791579 ansible.builtin.command: /usr/sbin/update-grub
15801580{{% else %}}
1581+ - name: Check if {{{ arg_name }}} argument is already present in /etc/default/grub
1582+ ansible.builtin.slurp:
1583+ src: /etc/default/grub
1584+ register: etc_default_grub
1585+
1586+ - name: Check if {{{ arg_name }}} argument is present
1587+ ansible.builtin.command: /sbin/grubby --info=ALL
1588+ register: grubby_info
1589+ check_mode: False
1590+ changed_when: False
1591+ failed_when: False
1592+
15811593- name: Update grub defaults and the bootloader menu
15821594 ansible.builtin.command: /sbin/grubby --update-kernel=ALL --remove-args="{{{ arg_name }}}"
1595+ when: (grubby_info.stdout is search('{{{ arg_name }}}')) or ((etc_default_grub['content'] | b64decode) is search('{{{ arg_name }}}'))
15831596{{% endif -%}}
15841597{{%- endmacro -%}}
15851598
You can’t perform that action at this time.
0 commit comments