Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colin-nolan/651a7ddadca873f82b9132536a354c76 to your computer and use it in GitHub Desktop.
Save colin-nolan/651a7ddadca873f82b9132536a354c76 to your computer and use it in GitHub Desktop.
Ansible change cron.daily time
# In Debian-world, cron.daily runs at a random time. This is an ansible task to
# change it to run at an hour specified by `cron_daily_time`.
- name: Change cron.daily to run at a specified time
become: yes
replace:
path: /etc/crontab
regexp: '(\S*[ \t])(\S*)([ \t].*cron\.daily)'
replace: '\g<1>{{ cron_daily_time }}\g<3>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment