updated cronjob that prune the docker system
This commit is contained in:
parent
012292c6fd
commit
46165cfdc4
|
|
@ -66,5 +66,6 @@ docker_label_state_mode: merge
|
|||
docker_node_labels: []
|
||||
# - { key: 'key_name', value: 'label_value' }
|
||||
|
||||
|
||||
docker_restart_daemon_cronjob: false
|
||||
docker_prune_dangling_volumes: false
|
||||
docker_system_prune_all: true
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LOG_FILE="/var/log/docker-system-prune.log"
|
||||
echo "===== $(date '+%Y-%m-%d %H:%M:%S') =====" >> "$LOG_FILE"
|
||||
# "system" prune, because pruning images only leaves a lot of garbage around
|
||||
docker system prune --force >> "$LOG_FILE" 2>&1
|
||||
|
||||
echo "" >> "$LOG_FILE"
|
||||
exit 0
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
LOG_FILE="/var/log/docker-volumes-prune.log"
|
||||
echo "===== $(date '+%Y-%m-%d %H:%M:%S') =====" >> "$LOG_FILE"
|
||||
# "system" prune, because pruning images only leaves a lot of garbage around
|
||||
docker volume prune --force >> "$LOG_FILE" 2>&1
|
||||
|
||||
echo "" >> "$LOG_FILE"
|
||||
exit 0
|
||||
|
|
@ -69,38 +69,38 @@
|
|||
- Restart containerd
|
||||
- Restart docker
|
||||
|
||||
- name: docker_setup | Cron job that prunes the dangling images
|
||||
- name: Cron job that prunes all the docker system
|
||||
block:
|
||||
- name: docker_setup | Install a script that prunes the docker dangling images
|
||||
- name: Install a script that prunes the entire docker system
|
||||
copy:
|
||||
src: docker-prune-dangling-images.sh
|
||||
dest: /usr/local/sbin/docker-prune-dangling-images
|
||||
src: docker-system-prune-all.sh
|
||||
dest: /usr/local/sbin/docker-system-prune-all
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0744"
|
||||
mode: 0744
|
||||
|
||||
- name: docker_setup | Install a cron job that prunes the docker images
|
||||
- name: Install a cron job that prunes the entire docker system
|
||||
cron:
|
||||
name: Prune docker images
|
||||
cron_file: docker-prune-images
|
||||
name: Prune docker system
|
||||
cron_file: docker-system-prune-all
|
||||
special_time: daily
|
||||
user: root
|
||||
state: present
|
||||
job: "/usr/local/sbin/docker-prune-dangling-images"
|
||||
when: docker_prune_dangling_images
|
||||
job: "/usr/local/sbin/docker-system-prune-all"
|
||||
when: docker_system_prune_all
|
||||
|
||||
- name: docker_setup | Disable the cron job that prunes the docker images
|
||||
- name: Disable the cron job that prunes the docker system
|
||||
cron:
|
||||
name: Prune docker images
|
||||
cron_file: docker-prune-images
|
||||
name: Prune docker system
|
||||
cron_file: docker-system-prune-all
|
||||
special_time: daily
|
||||
user: root
|
||||
state: absent
|
||||
job: "/usr/local/sbin/docker-prune-dangling-images"
|
||||
when: not docker_prune_dangling_images
|
||||
job: "/usr/local/sbin/docker-system-prune-all"
|
||||
when: not docker_system_prune_all
|
||||
|
||||
when: docker_install
|
||||
tags: [docker, docker_prune_images]
|
||||
tags: [docker, docker_system_prune_all]
|
||||
|
||||
- name: docker_setup | Cron job that restart docker daemon daily
|
||||
block:
|
||||
|
|
@ -137,37 +137,3 @@
|
|||
when: docker_install
|
||||
tags: [docker, docker_restart_daemon_cronjob]
|
||||
|
||||
- name: docker_setup | Cron job that prunes the dangling volumes
|
||||
block:
|
||||
- name: docker_setup | Install a script that prunes the docker dangling volumes
|
||||
copy:
|
||||
src: docker-prune-dangling-volumes.sh
|
||||
dest: /usr/local/sbin/docker-prune-dangling-volumes
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0744"
|
||||
|
||||
- name: docker_setup | Install a cron job that prunes the docker volumes
|
||||
cron:
|
||||
name: Prune docker volumes
|
||||
cron_file: docker-prune-volumes
|
||||
minute: "0"
|
||||
hour: "*/12"
|
||||
user: root
|
||||
state: present
|
||||
job: "/usr/local/sbin/docker-prune-dangling-volumes"
|
||||
when: docker_prune_dangling_volumes
|
||||
|
||||
- name: docker_setup | Disable the cron job that prunes the docker volumes
|
||||
cron:
|
||||
name: Prune docker volumes
|
||||
cron_file: docker-prune-volumes
|
||||
minute: "0"
|
||||
hour: "*/12"
|
||||
user: root
|
||||
state: absent
|
||||
job: "/usr/local/sbin/docker-prune-dangling-volumes"
|
||||
when: not docker_prune_dangling_volumes
|
||||
|
||||
when: docker_install
|
||||
tags: [docker, docker_prune_volumes]
|
||||
|
|
|
|||
Loading…
Reference in New Issue