You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/logrotate/tasks/main.yml

30 lines
645 B
YAML

---
# Install and configure logrotate
# Install the apt package
- name: Install logrotate
apt:
name:
- logrotate
# Copy the configuration and reload the service if it has changed
- name: Configure logrotate
template:
src: logrotate.d/rsyslog.j2
dest: /etc/logrotate.d/rsyslog
owner: root
group: root
mode: "0644"
notify: reload logrotate
# Make sure the service is enabled and started
- name: Enable logrotate service
service:
name: logrotate
enabled: true
state: started
# Enforce new logrotate rules now
- name: Run logrotate now
command: /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog