You can configure multiple log paths for a single script entry using the paths key, and execute commands after rotation using the scripts dictionary.
Example of configuring Nginx logs with a postrotate command:
- hosts: all
vars:
logrotate_scripts:
- name: nginx-options
path: /var/log/nginx/options.log
options:
- daily
- weekly
- size 25M
- rotate 7
- missingok
- compress
- delaycompress
- copytruncate
- name: nginx-scripts
path: /var/log/nginx/scripts.log
options:
- daily
- weekly
- size 25M
scripts:
postrotate: "echo test"
roles:
- ansible-logrotate