34 lines
810 B
YAML
34 lines
810 B
YAML
# vim: ft=yaml.ansible
|
|
---
|
|
- name: Create base directory for Docker volumes
|
|
ansible.builtin.file:
|
|
name: "{{ base_volume }}"
|
|
owner: root
|
|
mode: u=rwx,g=rx,o=rx
|
|
state: directory
|
|
|
|
- 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
|
|
|
|
- name: Create Docker network for services
|
|
community.docker.docker_network:
|
|
name: services
|
|
ipam_config:
|
|
- subnet: 172.16.0.0/16
|
|
gateway: 172.16.0.1
|
|
state: present
|