From d55060d20528f3f2e0e046853c889957979dcbbb Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Thu, 29 Aug 2019 20:04:28 +0200 Subject: [PATCH] os-cluster: add cronjob to delete old images from nodes Signed-off-by: Clement Verna --- playbooks/groups/os-cluster.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/playbooks/groups/os-cluster.yml b/playbooks/groups/os-cluster.yml index 4b56286dcf..bf701c1efe 100644 --- a/playbooks/groups/os-cluster.yml +++ b/playbooks/groups/os-cluster.yml @@ -248,3 +248,18 @@ - name: Enable wildcard routes command: oc -n default set env dc/router ROUTER_ALLOW_WILDCARD_ROUTES=true changed_when: false + + +- name: Add a cleanup cron job to the nodes + hosts: os_nodes_stg:os_nodes + tags: + - os-node-cleanup + tasks: + - name: Ensure a job that runs every Mondays to clean old docker images from the nodes. + cron: + name: "remove docker dangling images" + weekday: "1" + minute: "0" + hour: "0" + job: "docker rmi $(docker images --filter dangling=true -q)" + state: present