merge from main
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
---
|
||||
- include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: get reports
|
||||
ansible.builtin.find:
|
||||
paths: "{{ doc_root }}/{{ reports_dir }}"
|
||||
patterns: '*.html'
|
||||
register: reports
|
||||
check_mode: no
|
||||
|
||||
- name: publish landing page
|
||||
ansible.builtin.template:
|
||||
src: linux_report.j2
|
||||
dest: "{{ doc_root }}/index.html"
|
||||
check_mode: no
|
||||
|
||||
- name: copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
|
||||
- name: copy logos over
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "report.png"
|
||||
check_mode: no
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
- include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: get reports
|
||||
ansible.windows.win_find:
|
||||
paths: "{{ doc_root }}/{{ reports_dir }}"
|
||||
patterns: '*.html'
|
||||
register: reports
|
||||
check_mode: no
|
||||
|
||||
- name: publish landing page
|
||||
ansible.builtin.win_template:
|
||||
src: windows_report.j2
|
||||
dest: "{{ doc_root }}/index.html"
|
||||
check_mode: no
|
||||
|
||||
- name: copy CSS over
|
||||
ansible.builtin.win_copy:
|
||||
src: "css"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
|
||||
- name: copy logos over
|
||||
ansible.builtin.win_copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "report.png"
|
||||
check_mode: no
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
galaxy_info:
|
||||
author: morenod
|
||||
description: Role created to configure a client to execute openscap policies based on the information obtained from a Red Hat Satellite/Foreman Host.
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- name: Install openscap client packages
|
||||
<<<<<<< HEAD
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- openscap-scanner
|
||||
@@ -37,11 +38,51 @@
|
||||
force_basic_auth: false
|
||||
body_format: json
|
||||
validate_certs: false
|
||||
=======
|
||||
yum:
|
||||
name:
|
||||
- openscap-scanner
|
||||
- rubygem-foreman_scap_client
|
||||
state: present
|
||||
|
||||
- name: Get Policy parameters
|
||||
uri:
|
||||
url: "{{ foreman_server_url }}/api/v2/compliance/policies"
|
||||
method: GET
|
||||
user: "{{ foreman_username }}"
|
||||
password: "{{ foreman_password }}"
|
||||
force_basic_auth: yes
|
||||
body_format: json
|
||||
validate_certs: False
|
||||
register: policies
|
||||
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
|
||||
|
||||
- name: Build policy {{ policy_name }} parameters
|
||||
set_fact:
|
||||
policy: "{{ policy | default([]) }} + {{ [item] }}"
|
||||
loop: "{{policies.json.results}}"
|
||||
when: item.name in policy_name or policy_name == 'all'
|
||||
|
||||
- name: Fail if no policy found with required name
|
||||
fail:
|
||||
when: policy is not defined
|
||||
|
||||
- name: Get scap content information
|
||||
uri:
|
||||
url: "{{ foreman_server_url }}/api/v2/compliance/scap_contents/{{item.scap_content_id}}"
|
||||
method: GET
|
||||
user: "{{ foreman_username }}"
|
||||
password: "{{ foreman_password }}"
|
||||
force_basic_auth: yes
|
||||
body_format: json
|
||||
validate_certs: False
|
||||
>>>>>>> main
|
||||
register: scapcontents
|
||||
loop: "{{ policy }}"
|
||||
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
|
||||
|
||||
- name: Get tailoring content information
|
||||
<<<<<<< HEAD
|
||||
ansible.builtin.uri:
|
||||
url: "{{ foreman_server_url }}/api/v2/compliance/tailoring_files/{{ item.tailoring_file_id }}"
|
||||
method: GET
|
||||
@@ -50,12 +91,23 @@
|
||||
force_basic_auth: false
|
||||
body_format: json
|
||||
validate_certs: false
|
||||
=======
|
||||
uri:
|
||||
url: "{{ foreman_server_url }}/api/v2/compliance/tailoring_files/{{item.tailoring_file_id}}"
|
||||
method: GET
|
||||
user: "{{ foreman_username }}"
|
||||
password: "{{ foreman_password }}"
|
||||
force_basic_auth: yes
|
||||
body_format: json
|
||||
validate_certs: False
|
||||
>>>>>>> main
|
||||
register: tailoringfiles
|
||||
when: item.tailoring_file_id | int > 0 | d(False)
|
||||
loop: "{{ policy }}"
|
||||
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
|
||||
|
||||
- name: Build scap content parameters
|
||||
<<<<<<< HEAD
|
||||
ansible.builtin.set_fact:
|
||||
scap_content: "{{ scap_content | default({}) | combine({item.json.id: item.json}) }}"
|
||||
loop: "{{ scapcontents.results }}"
|
||||
@@ -63,10 +115,20 @@
|
||||
- name: Build tailoring content parameters
|
||||
ansible.builtin.set_fact:
|
||||
tailoring_files: "{{ tailoring_files | default({}) | combine({item.json.id: item.json}) }}"
|
||||
=======
|
||||
set_fact:
|
||||
scap_content: "{{ scap_content | default({}) | combine({item.json.id: item.json }) }}"
|
||||
loop: "{{ scapcontents.results }}"
|
||||
|
||||
- name: Build tailoring content parameters
|
||||
set_fact:
|
||||
tailoring_files: "{{ tailoring_files | default({}) | combine({item.json.id: item.json }) }}"
|
||||
>>>>>>> main
|
||||
when: item.json is defined
|
||||
loop: "{{ tailoringfiles.results }}"
|
||||
|
||||
- name: Apply openscap client configuration template
|
||||
<<<<<<< HEAD
|
||||
ansible.builtin.template:
|
||||
src: openscap_client_config.yaml.j2
|
||||
dest: /etc/foreman_scap_client/config.yaml
|
||||
@@ -83,3 +145,21 @@
|
||||
# hour: "{{crontab_hour}}"
|
||||
# minute: "{{crontab_minute}}"
|
||||
# user: root
|
||||
=======
|
||||
template:
|
||||
src: openscap_client_config.yaml.j2
|
||||
dest: /etc/foreman_scap_client/config.yaml
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
#- name: Configure execution crontab
|
||||
# cron:
|
||||
# name: "Openscap Execution"
|
||||
# cron_file: 'foreman_openscap_client'
|
||||
# job: '/usr/bin/foreman_scap_client {{policy.id}} > /dev/null'
|
||||
# weekday: "{{crontab_weekdays}}"
|
||||
# hour: "{{crontab_hour}}"
|
||||
# minute: "{{crontab_minute}}"
|
||||
# user: root
|
||||
>>>>>>> main
|
||||
|
||||
Reference in New Issue
Block a user