Ansible change cron.daily time
In Debian-world, cron.daily runs at a random time on the 6 AM hour. This is an ansible task to change it to run at exactly midnight.
- name: Change cron.daily to run at midnight
replace:
dest: /etc/crontab
regexp: '[0-9]{1,2}\s(6)\s.*cron.daily'
replace: '{{ cron_daily_time }} * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )'
become: yes