Remove rsyslog logrotate job, remove default log files

This commit is contained in:
Ryan Cavicchioni 2019-11-21 21:41:29 -06:00
parent b8d6c5a3f7
commit c8ac7c5f0a
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
2 changed files with 33 additions and 10 deletions

View File

@ -4,18 +4,26 @@
rsyslog_default_rules_state: absent rsyslog_default_rules_state: absent
when: rsyslog_archival_format_enabled when: rsyslog_archival_format_enabled
- name: check status of /var/log/syslog - name: find default log files
stat: find:
path: /var/log/syslog path: /var/log
register: st file_type: file
pattern: "{{ rsyslog_default_log_patterns }}"
when: rsyslog_archival_format_enabled
register: default_log_files
- name: delete files - name: delete files
file: file:
path: "{{ item }}" path: "{{ item.path }}"
state: "{{ rsyslog_archival_format_enabled | ternary('absent', 'file') }}" state: "{{ rsyslog_archival_format_enabled | ternary('absent', 'file') }}"
when: rsyslog_archival_format_enabled and st.stat.exists and st.stat.isreg when: rsyslog_archival_format_enabled
with_items: with_items: "{{ default_log_files.files }}"
- /var/log/syslog
- name: delete logrotate configuration
file:
path: /etc/logrotate.d/rsyslog
state: absent
when: rsyslog_archival_format_enabled
- name: configure archival format - name: configure archival format
template: template:

View File

@ -14,3 +14,18 @@ rsyslog_default_rules:
- "mail.* -/var/log/mail.log" - "mail.* -/var/log/mail.log"
- "mail.err /var/log/mail.err" - "mail.err /var/log/mail.err"
- "*.emerg :omusrmsg:*" - "*.emerg :omusrmsg:*"
rsyslog_default_log_patterns:
- auth.log*
- cron.log*
- daemon.log*
- debug*
- kern.log*
- lpr.log*
- mail.err*
- mail.info*
- mail.log*
- mail.warn*
- messages*
- syslog*
- user.log*