blob: 9dcf10381d795933207f15bbf5ab5dfde5243cf0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
- name: Read Docker config
block:
- name: Read daemon.json
become: true
ansible.builtin.slurp:
src: /etc/docker/daemon.json
register: current_docker_config
- name: Parse daemon.json
ansible.builtin.set_fact:
current_docker_config: '{{ current_docker_config.content | b64decode | from_json }}'
rescue:
- name: daemon.json is missing
ansible.builtin.set_fact:
current_docker_config: {}
- name: Modify Docker config
become: true
ansible.builtin.copy:
dest: /etc/docker/daemon.json
content: '{{ current_docker_config | combine({"log-driver": docker_logging_driver}) | to_nice_json }}'
owner: root
group: root
mode: '644'
notify: docker_restart
|