Automate cron and at Jobs
WebAsha moves its scheduled jobs into Ansible: a heartbeat for the devops account, a weekday backup on production, a boot marker and a one-off disk report on test, and an old job on node4 that must go. `ansible.posix` is installed in `~/ansible/collections`.
Tasks
- Write ~/ansible/cron.yml: on dev, a cron job named webasha heartbeat for user devops that runs logger "WebAsha heartbeat" every 2 minutes.
- Add to cron.yml: on prod, the system cron file /etc/cron.d/webasha-backup runs /usr/local/bin/backup.sh as root at 02:30 Monday to Friday.
- Write ~/ansible/boot.yml: on test, a root cron job named mark boot that runs /usr/bin/touch /var/tmp/booted at every reboot.
- Write ~/ansible/at.yml: on test, schedule a one-time at job that runs /usr/bin/df -h /tmp/df.txt in 20 minutes. Running the playbook twice must not queue it twice.
- Write ~/ansible/cleanup.yml: remove the root cron job named legacy-sync from node4.