Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

role: hosted_engine_setup: Get the appliance distribution in a correct way #249

Merged
merged 1 commit into from Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions roles/hosted_engine_setup/tasks/apply_openscap_profile.yml
@@ -1,12 +1,16 @@
---
- name: Get appliance distribution
setup:
filter: ansible_distribution*
register: appliance_dist
- name: Initialize OpenSCAP variables
set_fact:
oscap_dir: "/usr/share/xml/scap/ssg/content"
oscap_dist: "{{ ansible_distribution | replace('RedHat', 'rhel') | lower }}"
oscap_ver: "{{ ansible_distribution_major_version if ansible_distribution != 'Fedora' else '' }}"
oscap_dist: "{{ appliance_dist.ansible_facts.ansible_distribution }}"
oscap_ver: "{{ appliance_dist.ansible_facts.ansible_distribution_major_version if ansible_distribution != 'Fedora' else '' }}"
- name: Set OpenSCAP datastream path
set_fact:
oscap_datastream: "{{ oscap_dir }}/ssg-{{ oscap_dist }}{{ oscap_ver }}-ds.xml"
oscap_datastream: "{{ oscap_dir }}/ssg-{{ oscap_dist | replace('RedHat', 'rhel') | lower }}{{ oscap_ver }}-ds.xml"
- debug: var=oscap_datastream
- name: Verify OpenSCAP datastream
stat:
Expand All @@ -27,6 +31,7 @@
failed_when: false
ignore_errors: true
changed_when: true
when: oscap_profile.stdout is defined
- name: Reset PermitRootLogin for sshd
lineinfile: dest=/etc/ssh/sshd_config
regexp="^\s*PermitRootLogin"
Expand All @@ -45,4 +50,4 @@
fail:
msg: "FIPS mode is not enabled as required"
when: he_fips_enabled.stdout != "1"
when: ansible_distribution is search("RedHat")
when: oscap_dist == "RedHat"