Skip to content
Draft
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 @@ -29,3 +29,4 @@ template:
vars:
pkgname: libselinux
pkgname@sle15: libselinux1
pkgname@sle16: libselinux1
2 changes: 1 addition & 1 deletion product_properties/10-login-defs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ default:
login_defs_path: "/etc/login.defs"

overrides:
{{% if product == 'slmicro6' %}}
{{% if product in [ 'slmicro6', 'sle16' ] %}}
login_defs_path: "/usr/etc/login.defs"
{{% endif %}}
5 changes: 5 additions & 0 deletions products/sle16/profiles/base.profile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ description: |-

selections:
- base_sle16:all
- package_libselinux_installed
- no_shelllogin_for_systemaccounts
- grub2_spectre_v2_argument
- grub2_nosmep_argument_absent
- grub2_audit_argument
14 changes: 7 additions & 7 deletions shared/macros/10-ansible.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,7 @@ Part of the grub2_bootloader_argument template.

#}}
{{%- macro ansible_grub2_bootloader_argument(arg_name, arg_name_value, arg_variable) -%}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15', 'slmicro5'] %}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15', 'sle16', 'slmicro5'] %}}
- name: Check {{{ arg_name }}} argument exists
ansible.builtin.command: grep '^\s*GRUB_CMDLINE_LINUX=.*{{{ arg_name }}}=' /etc/default/grub
check_mode: False
Expand Down Expand Up @@ -1541,7 +1541,7 @@ Part of the grub2_bootloader_argument template.

{{% endif -%}}

{{% if product in ['sle12', 'sle15', 'slmicro5'] %}}
{{% if product in ['sle12', 'sle15', 'sle16', 'slmicro5'] %}}
- name: Update grub defaults and the bootloader menu
ansible.builtin.command: /usr/sbin/grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
{{% elif 'debian' in product %}}
Expand Down Expand Up @@ -1580,9 +1580,9 @@ Part of the grub2_bootloader_argument_absent template.

#}}
{{%- macro ansible_grub2_bootloader_argument_absent(arg_name) -%}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15'] %}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15', 'sle16'] %}}
- name: Check {{{ arg_name }}} argument exists
ansible.builtin.command: grep '^GRUB_CMDLINE_LINUX=.*{{{ arg_name }}}=.*"' /etc/default/grub
ansible.builtin.command: grep -E '^GRUB_CMDLINE_LINUX=.*{{{ arg_name }}}=?.*"' /etc/default/grub
check_mode: False
failed_when: False
changed_when: False
Expand All @@ -1591,13 +1591,13 @@ Part of the grub2_bootloader_argument_absent template.
- name: Replace existing {{{ arg_name }}} argument
ansible.builtin.replace:
path: /etc/default/grub
regexp: '\(^GRUB_CMDLINE_LINUX=".*\){{{ arg_name }}}=?[^[:space:]]*\(.*"\)'
replace: '\1 \2'
regexp: (^GRUB_CMDLINE_LINUX=\".*){{{ arg_name }}}(\s|=[0-9a-zA-Z]+)?(.*\")
replace: '\1 \3'
when: argcheck is not skipped and argcheck.rc == 0

{{% endif -%}}

{{% if product in ['sle12', 'sle15'] %}}
{{% if product in ['sle12', 'sle15', 'sle16'] %}}
- name: Update grub defaults and the bootloader menu
ansible.builtin.command: /usr/sbin/grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
{{% elif 'debian' in product %}}
Expand Down
10 changes: 5 additions & 5 deletions shared/macros/10-bash.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ Part of the grub2_bootloader_argument template.

#}}
{{% macro grub2_bootloader_argument_remediation(arg_name, arg_name_value) %}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15', 'slmicro5'] %}}
{{% if 'ubuntu' in product or 'debian' in product or product in ['ol7', 'sle12', 'sle15', 'sle16', 'slmicro5'] %}}
{{{ update_etc_default_grub_manually(arg_name, arg_name_value) }}}
{{% endif -%}}
{{{ grub_command("add", arg_name_value) }}}
Expand All @@ -1985,7 +1985,7 @@ Part of the grub2_bootloader_argument template.
#}}
{{%- macro update_etc_default_grub_manually_absent(arg_name) -%}}
# Correct the form of default kernel command line in GRUB
if grep -q '^GRUB_CMDLINE_LINUX=.*{{{ arg_name }}}=.*"' '/etc/default/grub' ; then
if grep -q -E '^GRUB_CMDLINE_LINUX=.*{{{ arg_name }}}=?.*"' '/etc/default/grub' ; then
sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\){{{ arg_name }}}=\?[^[:space:]]*\(.*"\)/\1 \2/' '/etc/default/grub'
fi
{{%- endmacro %}}
Expand All @@ -2000,7 +2000,7 @@ Part of the grub2_bootloader_argument_absent template.

#}}
{{% macro grub2_bootloader_argument_absent_remediation(arg_name) %}}
{{% if 'ubuntu' in product or product in ['ol7', 'sle12', 'sle15', 'slmicro5'] %}}
{{% if 'ubuntu' in product or product in ['ol7', 'sle12', 'sle15', 'sle16', 'slmicro5'] %}}
{{{ update_etc_default_grub_manually_absent(arg_name) }}}
{{% endif -%}}
{{{ grub_command("remove", arg_name) }}}
Expand Down Expand Up @@ -2285,11 +2285,11 @@ for f in $(echo -n "{{{ files }}}"); do
# find key in section and change value
if grep -qzosP "[[:space:]]*\[{{{ section }}}\]([^\n\[]*\n+)+?[[:space:]]*{{{ key }}}" "$f"; then
if ! grep -qPz "{{{ key }}}={{{ value }}}" "$f"; then
{{% if no_quotes %}}
{{% if no_quotes %}}
sed -i "s/{{{ key }}}[^(\n)]*/{{{ key }}}={{{ value | replace("/", "\/") }}}/" "$f"
{{% else %}}
sed -i 's/{{{ key }}}[^(\n)]*/{{{ key }}}="{{{ value | replace("/", "\/") }}}"/' "$f"
{{% endif %}}
{{% endif %}}
fi

found=true
Expand Down
Loading