Add apt-maintenance role
This commit is contained in:
parent
785924e5ba
commit
acdb50458f
8
ubuntu/roles/apt-maintenance/files/apt-maintenance.sh
Normal file
8
ubuntu/roles/apt-maintenance/files/apt-maintenance.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Update repositories
|
||||
apt-get update
|
||||
# Update packages
|
||||
apt-get -y upgrade
|
||||
# Autoremove packages
|
||||
apt-get -y autoremove
|
18
ubuntu/roles/apt-maintenance/tasks/main.yml
Normal file
18
ubuntu/roles/apt-maintenance/tasks/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
# This task adds a daily cron job to do apt related maintenance
|
||||
# Update repos, update packages, autoremove packages
|
||||
|
||||
- name: Copy cron script
|
||||
copy:
|
||||
src: apt-maintenance.sh
|
||||
dest: /etc/cron.daily/apt-maintenance.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0744
|
||||
backup: yes
|
||||
|
||||
- name: Restart cron daemon
|
||||
service:
|
||||
name: cron
|
||||
state: restarted
|
||||
|
Loading…
Reference in New Issue
Block a user