ansible/roles/logrotate/tasks/main.yml

35 lines
661 B
YAML
Raw Normal View History

2021-01-23 14:25:35 +01:00
---
# Install the apt package
2021-01-23 14:41:25 +01:00
- name: Install logrotate
apt:
name:
- logrotate
state: present
- name: Create rsyslog configuration directory
file:
path: /etc/rsyslog.d
owner: root
group: root
mode: u=rwx,g=rx,o=rx
2021-01-23 14:25:35 +01:00
- name: Configure logrotate
template:
src: logrotate.conf
dest: /etc/logrotate.conf
2021-01-23 14:25:35 +01:00
owner: root
2021-01-23 15:59:03 +01:00
group: root
mode: u=rwx,g=r,o=r
notify: Reload logrotate
2021-01-23 14:25:35 +01:00
- name: Enable logrotate service
systemd:
name: logrotate.service
2021-01-23 14:25:35 +01:00
enabled: true
state: started
2021-01-23 14:27:09 +01:00
# Enforce new logrotate rules now
- name: Run logrotate now
2021-01-23 14:37:18 +01:00
command: /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog
...