forked from ansible-lockdown/RHEL9-CIS
update audit output and remove jmespath
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
7dcb2cae1c
commit
54e4ee1588
3 changed files with 24 additions and 27 deletions
|
|
@ -90,31 +90,30 @@
|
|||
when:
|
||||
- audit_format == "json"
|
||||
block:
|
||||
- name: Pre Audit | Capture data {{ pre_audit_outfile }}
|
||||
ansible.builtin.shell: "cat {{ pre_audit_outfile }}"
|
||||
register: pre_audit
|
||||
- name: Pre Audit | Capture audit data if json format
|
||||
ansible.builtin.shell: grep -E '\"summary-line.*Count:.*Failed' "{{ pre_audit_outfile }}" | cut -d'"' -f4
|
||||
register: pre_audit_summary
|
||||
changed_when: false
|
||||
|
||||
- name: Pre Audit | Capture pre-audit result
|
||||
- name: Pre Audit | Set Fact for audit summary
|
||||
ansible.builtin.set_fact:
|
||||
pre_audit_summary: "{{ pre_audit.stdout | from_json | json_query(summary) }}"
|
||||
vars:
|
||||
summary: summary."summary-line"
|
||||
pre_audit_results: "{{ pre_audit_summary.stdout }}"
|
||||
|
||||
- name: Pre Audit | Capture audit data if documentation format
|
||||
when:
|
||||
- audit_format == "documentation"
|
||||
block:
|
||||
- name: Pre Audit | Capture data {{ pre_audit_outfile }} | documentation format
|
||||
ansible.builtin.shell: "tail -2 {{ pre_audit_outfile }}"
|
||||
register: pre_audit
|
||||
- name: Pre Audit | Capture audit data if documentation format
|
||||
ansible.builtin.shell: tail -2 "{{ pre_audit_outfile }}" | tac | tr '\n' ' '
|
||||
register: pre_audit_summary
|
||||
changed_when: false
|
||||
|
||||
- name: Pre Audit | Capture pre-audit result | documentation format
|
||||
- name: Pre Audit | Set Fact for audit summary
|
||||
ansible.builtin.set_fact:
|
||||
pre_audit_summary: "{{ pre_audit.stdout_lines }}"
|
||||
pre_audit_results: "{{ pre_audit_summary.stdout }}"
|
||||
|
||||
- name: Audit_Only | Run Audit Only
|
||||
when:
|
||||
- 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