diff --git a/README.md b/README.md index a22fc86..2215969 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ and configuration can be overridden, for additional informations please have a l **rsyslog_default_config**: Setup a default basic configuration stanza (default: "True") +**purge_config**: Purge existing config snippets (default: "False") Dependencies diff --git a/defaults/main.yml b/defaults/main.yml index 872e208..0bc7a8d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,7 @@ rsyslog_action_file_default_template: RSYSLOG_TraditionalFileFormat #rsyslog_action_file_template: "%rawmsg%\n" #rsyslog_priv_drop_to_user: syslog #rsyslog_priv_drop_to_group: syslog +purge_config: False items: [] rsyslog_default_config: "True" rsyslog_os_supported: no diff --git a/tasks/main.yml b/tasks/main.yml index c0e6ec6..1725a99 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -35,6 +35,15 @@ - restart rsyslog when: rsyslog_os_supported == True +- name: remove existing (custom/additional) configurations + tags: + - rsyslog + - files + file: + state: absent + path: "{{ rsyslog_include_path }}/" + when: purge_config == True + - name: create additional configuration directory tags: - rsyslog diff --git a/test.yml b/test.yml new file mode 100644 index 0000000..7d8cc24 --- /dev/null +++ b/test.yml @@ -0,0 +1,21 @@ +--- +- name: Test playbook + remote_user: root + hosts: all + vars: + + handlers: + + roles: + - role: ../../xdrum.rsyslog + rsyslog_default_config: True + purge_config: True + items: + - name: "20-iptables" + lines: + - ':msg, contains, "iptables" /var/log/iptables.log' + - '& ~' + - name: "30-dovecot" + lines: + - 'if $programname == "dovecot" and $syslogseverity <= "6" then ~' + - '& ~'