linting
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
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,6 +1,5 @@
|
||||
---
|
||||
- name: Install openscap client packages
|
||||
<<<<<<< HEAD
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- openscap-scanner
|
||||
@@ -38,51 +37,11 @@
|
||||
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
|
||||
@@ -91,23 +50,12 @@
|
||||
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 }}"
|
||||
@@ -115,20 +63,10 @@
|
||||
- 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
|
||||
@@ -145,21 +83,3 @@
|
||||
# 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