auditd move to separate tasks file

This commit is contained in:
danielkubat 2020-12-13 18:22:55 +01:00
parent cdd0e25232
commit c8cb5ef4cf
3 changed files with 39 additions and 33 deletions

View File

@ -33,6 +33,9 @@
- name: Configure PAM - name: Configure PAM
include: tasks/authentication.yml include: tasks/authentication.yml
- name: Configure auditd
include: tasks/auditd.yml
post_tasks: post_tasks:
- name: Touching run file that ansible has ran here - name: Touching run file that ansible has ran here
file: file:

View File

@ -0,0 +1,36 @@
---
- name: Ensure auditd is installed
package:
name: audit
state: present
tags:
- harden
- name: Ensure auditd is enabled
service:
name: auditd
enabled: true
- name: Ensure auditd buffer is OK
replace:
path: /etc/audit/rules.d/audit.rules
regexp: '-b \d+'
replace: '-b {{ audit_buffer }}'
notify:
- regenerate_auditd_rules
tags:
- harden
- name: Ensure collection audit rules are available
template:
src: "etc/audit/rules.d/collection.rules.j2"
dest: "/etc/audit/rules.d/collection.rules"
owner: root
group: root
mode: '0600'
backup: true
notify:
- regenerate_auditd_rules
- restart_auditd
tags:
- harden

View File

@ -151,39 +151,6 @@
tags: tags:
- harden - harden
- name: Auditd
block:
- name: Ensure auditd is installed
package:
name: audit
state: present
tags:
- harden
- name: Ensure auditd buffer is OK
replace:
path: /etc/audit/rules.d/audit.rules
regexp: '-b \d+'
replace: '-b {{ audit_buffer }}'
notify:
- regenerate_auditd_rules
tags:
- harden
- name: Ensure collection audit rules are available
template:
src: "etc/audit/rules.d/collection.rules.j2"
dest: "/etc/audit/rules.d/collection.rules"
owner: root
group: root
mode: '0600'
backup: true
notify:
- regenerate_auditd_rules
- restart_auditd
tags:
- harden
- name: Disable Services - name: Disable Services
service: service:
name: "{{ item }}" name: "{{ item }}"