mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2025-12-27 15:33:06 +00:00
tidy up
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
be9ee540d1
commit
af2ffa2368
2 changed files with 26 additions and 25 deletions
|
|
@ -1,14 +1,14 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Post Audit | Run post_remediation {{ benchmark }} audit
|
- name: Post Audit | Run post_remediation {{ benchmark }} audit
|
||||||
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ post_audit_outfile }} -g {{ group_names }}"
|
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -o {{ post_audit_outfile }} -g \"{{ group_names }}\""
|
||||||
changed_when: true
|
changed_when: true
|
||||||
environment:
|
environment:
|
||||||
AUDIT_BIN: "{{ audit_bin }}"
|
AUDIT_BIN: "{{ audit_bin }}"
|
||||||
AUDIT_CONTENT_LOCATION: "{{ audit_out_dir }}"
|
AUDIT_CONTENT_LOCATION: "{{ audit_out_dir }}"
|
||||||
AUDIT_FILE: goss.yml
|
AUDIT_FILE: goss.yml
|
||||||
|
|
||||||
- name: Post Audit | ensure audit files readable by users
|
- name: Post Audit | Ensure audit files readable by users
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
@ -21,14 +21,14 @@
|
||||||
when:
|
when:
|
||||||
- audit_format == "json"
|
- audit_format == "json"
|
||||||
block:
|
block:
|
||||||
- name: capture data {{ post_audit_outfile }}
|
- name: Post Audit | Capture data {{ post_audit_outfile }}
|
||||||
ansible.builtin.shell: cat {{ post_audit_outfile }}
|
ansible.builtin.shell: cat {{ post_audit_outfile }}
|
||||||
register: post_audit
|
register: discovered_post_audit
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Capture post-audit result
|
- name: Post Audit | Capture post-audit result
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
post_audit_summary: "{{ post_audit.stdout | from_json | community.general.json_query(summary) }}"
|
post_audit_summary: "{{ discovered_post_audit.stdout | from_json | json_query(summary) }}"
|
||||||
vars:
|
vars:
|
||||||
summary: summary."summary-line"
|
summary: summary."summary-line"
|
||||||
|
|
||||||
|
|
@ -36,11 +36,11 @@
|
||||||
when:
|
when:
|
||||||
- audit_format == "documentation"
|
- audit_format == "documentation"
|
||||||
block:
|
block:
|
||||||
- name: Post Audit | capture data {{ post_audit_outfile }}
|
- name: Post Audit | Capture data {{ post_audit_outfile }}
|
||||||
ansible.builtin.shell: tail -2 {{ post_audit_outfile }}
|
ansible.builtin.shell: tail -2 {{ post_audit_outfile }}
|
||||||
register: post_audit
|
register: discovered_post_audit
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Post Audit | Capture post-audit result
|
- name: Post Audit | Capture post-audit result
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
post_audit_summary: "{{ post_audit.stdout_lines }}"
|
post_audit_summary: "{{ discovered_post_audit.stdout_lines }}"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
- setup_audit
|
- setup_audit
|
||||||
tags:
|
tags:
|
||||||
- setup_audit
|
- setup_audit
|
||||||
ansible.builtin.include_tasks: LE_audit_setup.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: LE_audit_setup.yml
|
||||||
|
|
||||||
- name: Pre Audit Setup | Ensure {{ audit_conf_dir }} exists
|
- name: Pre Audit Setup | Ensure {{ audit_conf_dir }} exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|
@ -32,8 +33,8 @@
|
||||||
when:
|
when:
|
||||||
- audit_content == 'copy'
|
- audit_content == 'copy'
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ audit_conf_copy }}"
|
src: "{{ audit_local_copy }}"
|
||||||
dest: "{{ audit_conf_dir }}"
|
dest: "{{ audit_conf_dest }}"
|
||||||
mode: preserve
|
mode: preserve
|
||||||
|
|
||||||
- name: Pre Audit Setup | Unarchive audit content files on server
|
- name: Pre Audit Setup | Unarchive audit content files on server
|
||||||
|
|
@ -57,27 +58,26 @@
|
||||||
- name: Pre Audit Setup | Check for goss file
|
- name: Pre Audit Setup | Check for goss file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ audit_bin }}"
|
path: "{{ audit_bin }}"
|
||||||
register: goss_available
|
register: discovered_goss_available
|
||||||
|
|
||||||
- name: Pre Audit Setup | If audit ensure goss is available
|
- name: Pre Audit Setup | If audit ensure goss is available
|
||||||
when:
|
|
||||||
- not goss_available.stat.exists
|
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
|
that: discovered_goss_available.stat.exists
|
||||||
msg: "Audit has been selected: unable to find goss binary at {{ audit_bin }}"
|
msg: "Audit has been selected: unable to find goss binary at {{ audit_bin }}"
|
||||||
|
|
||||||
- name: Pre Audit Setup | Copy ansible default vars values to test audit
|
- name: Pre Audit Setup | Copy ansible default vars values to test audit
|
||||||
|
when:
|
||||||
|
- run_audit
|
||||||
tags:
|
tags:
|
||||||
- goss_template
|
- goss_template
|
||||||
- run_audit
|
- run_audit
|
||||||
when:
|
|
||||||
- run_audit
|
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: ansible_vars_goss.yml.j2
|
src: ansible_vars_goss.yml.j2
|
||||||
dest: "{{ audit_vars_path }}"
|
dest: "{{ audit_vars_path }}"
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
|
|
||||||
- name: Pre Audit | Run pre_remediation {{ benchmark }} audit
|
- name: Pre Audit | Run pre_remediation {{ benchmark }} audit
|
||||||
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -o {{ pre_audit_outfile }} -g {{ group_names }}"
|
ansible.builtin.shell: "{{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\""
|
||||||
changed_when: true
|
changed_when: true
|
||||||
environment:
|
environment:
|
||||||
AUDIT_BIN: "{{ audit_bin }}"
|
AUDIT_BIN: "{{ audit_bin }}"
|
||||||
|
|
@ -88,14 +88,14 @@
|
||||||
when:
|
when:
|
||||||
- audit_format == "json"
|
- audit_format == "json"
|
||||||
block:
|
block:
|
||||||
- name: capture data {{ pre_audit_outfile }}
|
- name: Pre Audit | Capture data {{ pre_audit_outfile }}
|
||||||
ansible.builtin.shell: cat {{ pre_audit_outfile }}
|
ansible.builtin.shell: cat {{ pre_audit_outfile }}
|
||||||
register: pre_audit
|
register: discovered_pre_audit
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Pre Audit | Capture pre-audit result
|
- name: Pre Audit | Capture pre-audit result
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
pre_audit_summary: "{{ pre_audit.stdout | from_json | community.general.json_query(summary) }}"
|
pre_audit_summary: "{{ discovered_pre_audit.stdout | from_json | json_query(summary) }}"
|
||||||
vars:
|
vars:
|
||||||
summary: summary."summary-line"
|
summary: summary."summary-line"
|
||||||
|
|
||||||
|
|
@ -103,16 +103,17 @@
|
||||||
when:
|
when:
|
||||||
- audit_format == "documentation"
|
- audit_format == "documentation"
|
||||||
block:
|
block:
|
||||||
- name: Pre Audit | capture data {{ pre_audit_outfile }} | documentation format
|
- name: Pre Audit | Capture data {{ pre_audit_outfile }} | documentation format
|
||||||
ansible.builtin.shell: tail -2 {{ pre_audit_outfile }}
|
ansible.builtin.shell: tail -2 {{ pre_audit_outfile }}
|
||||||
register: pre_audit
|
register: discovered_pre_audit
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Pre Audit | Capture pre-audit result | documentation format
|
- name: Pre Audit | Capture pre-audit result | documentation format
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
pre_audit_summary: "{{ pre_audit.stdout_lines }}"
|
pre_audit_summary: "{{ discovered_pre_audit.stdout_lines }}"
|
||||||
|
|
||||||
- name: Audit_Only | Run Audit Only
|
- name: Audit_Only | Run Audit Only
|
||||||
when:
|
when:
|
||||||
- audit_only
|
- audit_only
|
||||||
ansible.builtin.import_tasks: audit_only.yml
|
ansible.builtin.import_tasks:
|
||||||
|
file: audit_only.yml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue