demo_ansible/roles/bootstrap/tasks/logrotate.yml

16 lines
508 B
YAML

---
- name: Install logrotate
ansible.builtin.apt:
name: "logrotate"
- name: Configure logrotate to rotate monthly
ansible.builtin.lineinfile: { path: /etc/logrotate.conf, regexp: "^weekly", line: "monthly" }
- name: Configure logrotate to keep 12 months
ansible.builtin.lineinfile: { path: /etc/logrotate.conf, regexp: "^rotate 4", line: "rotate 12" }
- name: Configure logrotate to compress
ansible.builtin.lineinfile: { path: /etc/logrotate.conf, regexp: "^#compress", line: "compress" }