Skip to content

Commit

Permalink
roles/docker: convert cron.daily job to cron.d
Browse files Browse the repository at this point in the history
Doesn't seem to be executing in cron.daily...

Signed-off-by: John Helmert III <[email protected]>
  • Loading branch information
ajakk committed Dec 24, 2023
1 parent 822cbd0 commit f58d9b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions roles/docker/files/docker-system-prune
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
#!/usr/bin/env bash

docker system prune -f 2>&1 >/dev/null || echo "pruning failed"
0 0 * * 1 root docker system prune -f 2>&1 >/dev/null || echo "pruning failed"
9 changes: 7 additions & 2 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
- name: Add homeassistant
ansible.builtin.include_tasks: homeassistant.yml
when: homeassistant
- name: Remove old cronjob
when: mervin or homeassistant
ansible.builtin.file:
path: /etc/cron.daily/docker-system-prune
state: absent
- name: Add cron job to prune Docker data
# TODO: this is hacky, should put the above in their own roles (and
# specify dependencies on traefik appropriately) then use this
# docker role to do generate configuration like this:
when: mervin or homeassistant
ansible.builtin.copy:
src: docker-system-prune
dest: /etc/cron.daily/docker-system-prune
mode: "0755"
dest: /etc/cron.d/docker-system-prune
mode: "0644"
owner: root
group: root

0 comments on commit f58d9b4

Please sign in to comment.