--- - hosts: all gather_facts: true become: true pre_tasks: - name: Set dc_domain from hostname ansible.builtin.set_fact: dc_domain: "{{ inventory_hostname | regex_replace('.+?\\.(.+)$', '\\g<1>') | lower }}" - name: Remediate OpenSCAP policy command: | oscap xccdf eval --datastream-id scap_org.open-scap_datastream_from_xccdf_ssg-rhel9-xccdf.xml \ --xccdf-id scap_org.open-scap_cref_ssg-rhel9-xccdf.xml \ --tailoring-file /usr/share/xml/scap/skat/ssg-rhel9-ds-tailoring.xml \ --profile xccdf_org.ssgproject.content_profile_ospp_customized \ --oval-results \ --report /tmp/report.html \ /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml register: result changed_when: result is failed #failed_when: false - name: ansible.builtin.stat: path: /tmp/report.html get_attributes: true get_checksum: false register: file_stat - name: Set report name set_fact: report_name: "{{ inventory_hostname }}.{{ '%Y-%m-%d.%H:%M:%S'|strftime(file_stat.stat.ctime) }}_no_remediate_review.html" - name: Download report fetch: src: /tmp/report.html dest: /tmp/{{ report_name }} flat: true roles: - upload-skat-openscap