This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker_services/tasks/config.yml

29 lines
768 B
YAML

# vim: ft=yaml.ansible
---
- name: Copy Docker daemon config file
ansible.builtin.template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
owner: root
mode: u=rw,g=r,o=r
register: daemon_config
- name: Disable and (re)start Docker daemon
ansible.builtin.service:
name: "{{ item }}"
enabled: false
state: "{{ 'restarted' if daemon_config.changed else 'started' }}"
loop:
- docker.socket
- docker.service
when: down is undefined or not down
- name: Configure cron job to prune unused Docker data weekly
ansible.builtin.cron:
name: Prune unused Docker data
cron_file: ansible_docker_prune
job: 'docker system prune -fa && docker volume prune -fa'
special_time: weekly
user: root
state: present