ansible-playbooks/ubuntu/roles/apt-maintenance/tasks/main.yml

31 lines
630 B
YAML

---
# This task adds a daily cron job to do apt related maintenance
# Update repos, update packages, autoremove packages
- name: Ensure /root/scripts exists
file:
path: /root/scripts
state: directory
- name: Copy cron script
copy:
src: apt-maintenance.sh
dest: /root/scripts/apt-maintenance.sh
owner: root
group: root
mode: 0755
backup: no
- name: Add MAILTO cron variable
cron:
name: MAILTO
env: yes
job: s+cron@sadiqs.com
- name: Add apt-maintenance cronjob
cron:
name: apt-maintenance
special_time: daily
job: /root/scripts/apt-maintenance.sh
backup: yes