From 66d9a6ebbcd74415720d011b1174315c8e681d0f Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Thu, 12 May 2016 12:18:38 -0700 Subject: [PATCH] updated to use handlers --- roles/docker/handlers/main.yml | 15 +++++++++++++++ roles/docker/tasks/systemd-proxies.yml | 10 +--------- 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 roles/docker/handlers/main.yml diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml new file mode 100644 index 000000000..4153d123d --- /dev/null +++ b/roles/docker/handlers/main.yml @@ -0,0 +1,15 @@ +--- +- name: restart docker + command: /bin/true + notify: + - reload systemd + - reload docker + +- name : reload systemd + shell: systemctl daemon-reload + when: ansible_service_mgr == "systemd" + +- name: reload docker + service: + name: docker + state: restarted diff --git a/roles/docker/tasks/systemd-proxies.yml b/roles/docker/tasks/systemd-proxies.yml index 38bbd716d..4bbc423c9 100644 --- a/roles/docker/tasks/systemd-proxies.yml +++ b/roles/docker/tasks/systemd-proxies.yml @@ -6,12 +6,4 @@ template: src: http-proxy.conf.j2 dest: /etc/systemd/system/docker.service.d/http-proxy.conf - register: systemddockerproxy - -- name: reload systemctl daemons - shell: systemctl daemon-reload - when: systemddockerproxy.changed - -- name: restart docker so configs are applies - service: name=docker state=restarted - when: systemddockerproxy.changed + notify: restart docker