Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@
# complexity = low
# disruption = low

- name: Verify GRUB_DISABLE_RECOVERY=true
- name: {{{ rule_title }}} - Verify GRUB_DISABLE_RECOVERY=true
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_DISABLE_RECOVERY=.*'
line: 'GRUB_DISABLE_RECOVERY=true'
state: present
register: grub_disable_recovery_changed

- name: Verify that Interactive Boot is Disabled in /etc/default/grub
- name: {{{ rule_title }}} - Verify that Interactive Boot is Disabled in /etc/default/grub
ansible.builtin.replace:
dest: /etc/default/grub
regexp: systemd.confirm_spawn(=(1|yes|true|on)|\b)
replace: systemd.confirm_spawn=no
register: grub_confirm_spawn_changed

- name: {{{ rule_title }}} - Verify that Interactive Boot is Disabled (runtime)
{{% if 'sle' in product %}}
- name: Verify that Interactive Boot is Disabled (runtime)
ansible.builtin.command: /usr/bin/grub2-editenv - unset systemd.confirm_spawn
{{% else %}}
- name: Verify that Interactive Boot is Disabled (runtime)
ansible.builtin.command: /sbin/grubby --update-kernel=ALL --remove-args="systemd.confirm_spawn"
{{% endif %}}
when: grub_confirm_spawn_changed is changed

- name: Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn
- name: {{{ rule_title }}} - Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn
ansible.builtin.command: grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
when: grub_disable_recovery_changed is changed or grub_confirm_spawn_changed is changed
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
# complexity = low
# disruption = low

- name: Verify GRUB_DISABLE_RECOVERY=true
- name: {{{ rule_title }}} - Verify GRUB_DISABLE_RECOVERY=true
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_DISABLE_RECOVERY=.*'
line: 'GRUB_DISABLE_RECOVERY=true'
state: present
register: grub_config_changed

{{% if product in ['sle12', 'sle15'] %}}
- name: Update grub defaults and the bootloader menu
- name: {{{ rule_title }}} - Update grub defaults and the bootloader menu
ansible.builtin.command: /usr/sbin/grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
{{% else %}}
- name: Update grub defaults and the bootloader menu
- name: {{{ rule_title }}} - Update grub defaults and the bootloader menu
ansible.builtin.command: /sbin/grubby --update-kernel=ALL
when: grub_config_changed is changed
{{% endif -%}}
Loading