Skip to content

Commit

Permalink
Merge pull request #10605 from teacup-on-rockingchair/sle_etc_issue_d…
Browse files Browse the repository at this point in the history
…ropin_remedy

SLES15 use dropin configuration for issue banner
  • Loading branch information
marcusburghardt committed Jul 11, 2023
2 parents 4b9c774 + 7b82d62 commit 2cf241a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,26 @@
# disruption = medium
{{{ ansible_instantiate_variables("login_banner_text") }}}

- name: "{{{ rule_title }}} - ensure correct banner"
{{%- if product not in ['sle15'] -%}}
- name: "{{{ rule_title }}} - Ensure Correct Banner"
copy:
dest: /etc/issue
content: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'
{{%- else -%}}
- name: {{{ rule_title }}} Ensure issue-generator is Installed
package:
name: "issue-generator"
state: present

- name: "{{{ rule_title }}} - Ensure Correct Banner"
copy:
dest: /etc/issue.d/99-oscap-setting
content: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'

- name: {{{ rule_title }}} Retart issue-generator Service on Issue Configration Change
ansible.builtin.systemd:
name: "issue-generator"
enabled: "yes"
state: "restarted"
masked: "no"
{{%- endif -%}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
{{{ bash_deregexify_banner_backslash("login_banner_text") }}}
formatted=$(echo "$login_banner_text" | fold -sw 80)

{{%- if product not in ['sle15'] %}}
cat <<EOF >/etc/issue
$formatted
EOF
{{%- else %}}
{{{ bash_package_install("issue-generator") }}}
cat <<EOF >/etc/issue.d/99-oscap-setting
$formatted
EOF
{{{ bash_service_command("restart", "issue-generator") }}}
{{%- endif -%}}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/issue", group="root")
ocil: |-
{{{ ocil_file_group_owner(file="/etc/issue", group="root") }}}
{{%- if product in ['sle15'] %}}
template:
name: file_groupowner
vars:
filepath: /etc/issue.d/
gid_or_name: '0'
file_regex: ^.*$
recursive: 'true'
{{%- else %}}
template:
name: file_groupowner
vars:
filepath: /etc/issue
gid_or_name: '0'
{{% endif %}}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ ocil_clause: '{{{ ocil_clause_file_owner(file="/etc/issue", owner="root") }}}'
ocil: |-
{{{ ocil_file_owner(file="/etc/issue", owner="root") }}}
{{%- if product in ['sle15'] %}}
template:
name: file_owner
vars:
filepath: /etc/issue.d/
fileuid: '0'
file_regex: ^.*$
recursive: 'true'
{{%- else %}}
template:
name: file_owner
vars:
filepath: /etc/issue
fileuid: '0'
{{%- endif -%}}

0 comments on commit 2cf241a

Please sign in to comment.