aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/docker/tasks/logging.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-31 23:13:51 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-31 23:17:51 +0200
commit003c4d40b0900c025192ba8e6332f7c0e5cd8a12 (patch)
treee9f5a936604257a9139dac7c967cdcc53461cce0 /roles/docker/tasks/logging.yml
parentv0.0.24 (diff)
downloadinfra-ansible-003c4d40b0900c025192ba8e6332f7c0e5cd8a12.tar.gz
infra-ansible-003c4d40b0900c025192ba8e6332f7c0e5cd8a12.zip
docker: factor out service restart as a handler
Diffstat (limited to 'roles/docker/tasks/logging.yml')
-rw-r--r--roles/docker/tasks/logging.yml17
1 files changed, 5 insertions, 12 deletions
diff --git a/roles/docker/tasks/logging.yml b/roles/docker/tasks/logging.yml
index 99d3cab..9dcf103 100644
--- a/roles/docker/tasks/logging.yml
+++ b/roles/docker/tasks/logging.yml
@@ -4,29 +4,22 @@
become: true
ansible.builtin.slurp:
src: /etc/docker/daemon.json
- register: docker_config
+ register: current_docker_config
- name: Parse daemon.json
ansible.builtin.set_fact:
- docker_config: '{{ docker_config.content | b64decode | from_json }}'
+ current_docker_config: '{{ current_docker_config.content | b64decode | from_json }}'
rescue:
- name: daemon.json is missing
ansible.builtin.set_fact:
- docker_config: {}
+ current_docker_config: {}
- name: Modify Docker config
become: true
ansible.builtin.copy:
dest: /etc/docker/daemon.json
- content: '{{ docker_config | combine({"log-driver": docker_logging_driver}) | to_nice_json }}'
+ content: '{{ current_docker_config | combine({"log-driver": docker_logging_driver}) | to_nice_json }}'
owner: root
group: root
mode: '644'
- register: daemon_json
-
-- name: Restart Docker
- become: true
- ansible.builtin.systemd_service:
- name: docker
- state: restarted
- when: daemon_json.changed
+ notify: docker_restart