---
- 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

- name: Configure logrotate
  template:
    src: logrotate.conf
    dest: /etc/logrotate.conf
    owner: root
    group: root
    mode: u=rwx,g=r,o=r
  notify: Reload logrotate

- name: Enable logrotate service
  systemd:
    name: logrotate.service
    enabled: true
    state: started
...