add auditd role

This commit is contained in:
aaron
2021-08-24 13:07:16 +02:00
parent 28d2e86454
commit f10a3dde5a
13 changed files with 494 additions and 0 deletions

23
tasks/configuration.yaml Normal file
View File

@@ -0,0 +1,23 @@
---
- name: push auditd configuration
template:
src: auditd.conf.j2
dest: '{{ auditd_config_dir }}/{{ auditd_config_file }}'
mode: '0640'
notify:
- restart auditd
- name: push custom rules
template:
src: custom.rules.j2
dest: '{{ auditd_custom_rules_dir }}/custom.rules'
mode: '0666'
notify:
- load custom rules
- name: start and enable auditd
service:
name: auditd
state: started
enabled: true

12
tasks/installation.yaml Normal file
View File

@@ -0,0 +1,12 @@
---
- name: install packages
package:
name: '{{ auditd_packages }}'
state: present
- name: ensure rules.d directory exists
file:
path: '{{ auditd_custom_rules_dir }}'
state: directory
mode: '0750'

19
tasks/main.yaml Normal file
View File

@@ -0,0 +1,19 @@
---
- name: load variables based on distribution type
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yaml'
- '{{ ansible_os_family }}.yaml'
tags:
- 'auditd_vars'
- name: install auditd and its components
import_tasks: installation.yaml
tags:
- 'auditd_installation'
- name: push auditd config
import_tasks: configuration.yaml
tags:
- 'auditd_configuration'