Skip to content

Instantly share code, notes, and snippets.

@WillPlatnick
Last active February 4, 2020 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save WillPlatnick/d68e83d4ed9ed0b7acc3 to your computer and use it in GitHub Desktop.
Save WillPlatnick/d68e83d4ed9ed0b7acc3 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment