aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml')
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml36
1 files changed, 36 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
new file mode 100644
index 0000000000..e030acbff2
--- /dev/null
+++ b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
@@ -0,0 +1,36 @@
+---
+# file: roles/cleanup/tasks/clean_images.yaml
+
+- name: Clean Docker Images
+ block:
+ - name: Clean Images - Prefetch Docker Images
+ cron:
+ name: "Prefetch docker image {{ item }}"
+ minute: "10"
+ hour: "7"
+ job: "/usr/bin/docker pull {{ item }}"
+ loop:
+ "{{ images_to_prefetch_by_arch[ansible_machine] }}"
+ tags:
+ - prefetch-docker-images
+
+ - name: Clean Images - Remove Dangling Docker Images
+ cron:
+ name: "Remove dangling docker images"
+ minute: "10"
+ hour: "5"
+ weekday: "7"
+ job: "/usr/bin/docker rmi $(/usr/bin/docker images --filter 'dangling=true' -q)"
+ tags:
+ - remove-docker-images-dangling
+
+ # TODO: Disabled until all images will be in registry
+ #- name: Clean Images - Prune Docker Images
+ # cron:
+ # name: "Prune docker images"
+ # minute: "10"
+ # hour: "6"
+ # weekday: 7
+ # job: "/usr/bin/docker image prune --all --force"
+ # tags:
+ # - prune-docker-images \ No newline at end of file