diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-23 10:28:50 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-23 10:28:50 +0200 |
commit | 9412cedba43319a18b9fd05ead36fd850d9aec26 (patch) | |
tree | 2ae5b0cf8406316d2b09555c89caec85e4532d3d | |
parent | docker: fix service name (diff) | |
download | infra-ansible-9412cedba43319a18b9fd05ead36fd850d9aec26.tar.gz infra-ansible-9412cedba43319a18b9fd05ead36fd850d9aec26.zip |
docker: move handlers to handlers/
-rw-r--r-- | roles/docker/handlers/main.yml | 11 | ||||
-rw-r--r-- | roles/docker/tasks/logging.yml | 17 |
2 files changed, 11 insertions, 17 deletions
diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml index 742a98c..1810b19 100644 --- a/roles/docker/handlers/main.yml +++ b/roles/docker/handlers/main.yml @@ -1,7 +1,12 @@ -- name: Restart Docker +- name: Collect service facts + ansible.builtin.service_facts: + listen: docker_configured + +- name: Restart Docker service become: true + when: | + 'docker.service' in ansible_facts.services and ansible_facts.services['docker.service'].state == 'running' ansible.builtin.systemd_service: - daemon_reload: true name: docker state: restarted - listen: docker_restart + listen: docker_configured diff --git a/roles/docker/tasks/logging.yml b/roles/docker/tasks/logging.yml index 27e78d4..8f861a3 100644 --- a/roles/docker/tasks/logging.yml +++ b/roles/docker/tasks/logging.yml @@ -32,18 +32,7 @@ owner: root group: root mode: '644' - register: docker_config + notify: docker_configured -- name: Restart Docker if necessary - become: true - when: docker_config.changed - block: - - name: Collect service facts - ansible.builtin.service_facts: - - - name: Restart Docker service - when: | - 'docker.service' in ansible_facts.services and ansible_facts.services['docker.service'].state == 'running' - ansible.builtin.systemd_service: - name: docker - state: restarted +- name: Restart Docker service if necessary + ansible.builtin.meta: flush_handlers |