Add cron job to prune unused Docker data
This commit is contained in:
parent
d3af3b9e28
commit
ca73aa5b9b
|
@ -7,6 +7,7 @@ usage() {
|
|||
printf '$ %s\n' "$0 [-h|--help]"
|
||||
printf '$ %s\n' "$0 [--dry] os"
|
||||
printf '$ %s\n' "$0 [--dry] docker"
|
||||
printf '$ %s\n' "$0 [--dry] docker_config"
|
||||
printf '$ %s\n' "$0 [--dry] firewall"
|
||||
printf '$ %s\n' "$0 [--dry] ssh"
|
||||
printf '$ %s\n' "$0 [--dry] users [-i|--init]"
|
||||
|
@ -38,7 +39,7 @@ fi
|
|||
case $TAG in
|
||||
"")
|
||||
install_modules; $EXEC "$BASE_CMD" ;;
|
||||
os|docker|firewall|ssh)
|
||||
os|docker|docker_config|firewall|ssh)
|
||||
install_modules; $EXEC "$BASE_CMD --tags '$TAG'" ;;
|
||||
users)
|
||||
install_modules
|
||||
|
|
|
@ -17,3 +17,12 @@
|
|||
- docker.socket
|
||||
- docker.service
|
||||
when: stop is undefined or not stop
|
||||
|
||||
- name: Configure cron job to prune unused Docker data weekly
|
||||
ansible.builtin.cron:
|
||||
name: Prune unused Docker data
|
||||
cron_file: ansible_docker_prune
|
||||
job: 'docker system prune -fa && docker volume prune -fa'
|
||||
special_time: weekly
|
||||
user: root
|
||||
state: present
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
- name: Configure Docker
|
||||
ansible.builtin.import_tasks: config.yml
|
||||
tags:
|
||||
- docker_config
|
||||
- reboot
|
||||
|
||||
- name: Set up Docker services
|
||||
|
|
Reference in a new issue