All,

I'm currently trying to compose a playbook to remove log files that are 
older than 90 days and then gzip the remaining files that are older than 7 
days.

I'm attempting to use the cron module of Ansible to do this but havign a 
bit of trouble.

Here's what I've done so far:

Created a job in my main.yml file

- name: Cron job to purge log files older than 90 days and gzip files on a 
daily rotation
  cron: minute="59" hour="23" weekday="*"
        name="freeradius log file rotation"
        cron_file="freeradius"
        user="root"
        job="/etc/cron.d/freeradius"
  tags:
    - cronradius






My cron_file (freeradius) looks like this:

find /var/log/freeradius/radacct/ -mtime +90 -print0 | xargs -0 rm && find /
var/log/freeradius/radacct/ -type f -mtime +7 -print0 | xargs -0 gzip




When I run the playbook against a server it copies the freeradius file 
across to /etc/cron.d/freeradius but when I "type" the contents of that 
file it displays:

59 23 * * * root /etc/cron.d/freeradius



and as a result I think this is incorrect, it appears to not be referencing 
the find command...

Any ideas what I am doing wrong?

Regards
Colin

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5bc3ae2e-bd6c-4d3a-ad36-c4bcdcd502d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to