# 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: "{{ stop is undefined or not stop }}"