Make docker install more reliable

This commit is contained in:
gabriel becker 2025-08-16 21:47:37 +10:00
parent a9623b63f1
commit 3460fe3302
3 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,3 @@
---
roles:
- name: community.docker.docker_compose
collections:
- name: community.docker

View File

@ -66,3 +66,12 @@
name: docker-compose-plugin
state: latest
update_cache: true
- name: Create daily Docker system prune cron job
ansible.builtin.cron:
name: "Daily Docker system prune"
minute: "0"
hour: "3"
job: "docker system prune -f --all"
user: root
state: present

View File

@ -1,4 +1,15 @@
---
- name: Prune Docker system before starting services
ansible.builtin.command: docker system prune -f --all
register: prune_output
ignore_errors: yes
changed_when: false
- name: Debug - Show Docker prune output
ansible.builtin.debug:
var: prune_output
verbosity: 1
- name: Ensure services destination directory exists
ansible.builtin.file:
path: "{{ server_services_dir }}"