---
- set_fact:
stig_id: V-219195
stig_text: "FAILED. Audit tools aren't configured with mode of 0755 or less permissive."
- local_action: lineinfile regexp='^V-219195' path="{{ output_path }}" state=absent
- name: Ensure audit tools have 0755 permissions.
block:
- name: check audit tools permissions.
become: true
stat:
path: "/sbin/{{ audit_loop }}"
loop:
- auditctl
- aureport
- ausearch
- autrace
- auditd
- audispd
- augenrules
loop_control:
loop_var: audit_loop
register: audit_tools
- set_fact:
stig_text: "{{ stig_id }} FAILED. Audit tools don't have 0755 permissions."
when: audit_tools.stat.mode != '0755'
- set_fact:
stig_text: "PASSED"
rescue:
- name: change the audit tools' permissions to 0755.
become: true
file:
path: "/sbin/{{ item.audit_loop }}"
mode: 0755
state: "{{ 'file' if item.stat.exists else 'touch' }}"
loop: "{{ audit_tools.results }}"
register: file_perms_rule
- set_fact:
stig_text: "PASSED"
when: file_perms_rule.changed
- debug:
msg: "{{ stig_id }} {{ stig_text }}"
always:
- local_action: lineinfile line="{{ stig_id }} {{ stig_text }}" path="{{ output_path }}" create=yes