diff --git a/main.yml b/main.yml index 6ea6365..b8186e2 100644 --- a/main.yml +++ b/main.yml @@ -12,9 +12,9 @@ - hosts: docker_cluster roles: - - node_explorer +# - node_explorer # - ssh -# - docker-cluster + - docker-cluster # - ubuntu # #- hosts: raspberry diff --git a/roles/docker-cluster/tasks/docker-cron.yml b/roles/docker-cluster/tasks/docker-cron.yml new file mode 100644 index 0000000..ef8cc82 --- /dev/null +++ b/roles/docker-cluster/tasks/docker-cron.yml @@ -0,0 +1,17 @@ +- name: Clean docker system + become: yes + ansible.builtin.cron: + user: root + name: "clean docker system" + minute: "0" + hour: "3" + job: "/usr/bin/docker system prune -f" + +- name: Clean docker image cache + become: yes + ansible.builtin.cron: + user: root + name: "clean docker system" + minute: "0" + hour: "3" + job: "/usr/bin/docker image prune -a -f" diff --git a/roles/docker-cluster/tasks/main.yml b/roles/docker-cluster/tasks/main.yml index 0fca0ae..c6b7e4b 100644 --- a/roles/docker-cluster/tasks/main.yml +++ b/roles/docker-cluster/tasks/main.yml @@ -13,4 +13,6 @@ - import_tasks: docker-watcher.yml -- import_tasks: ssh-external.yml \ No newline at end of file +- import_tasks: ssh-external.yml + +- import_tasks: docker-cron.yml \ No newline at end of file