From 492e2394d4d23e77d80b7dd5d96ec8f28d56746d Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Tue, 24 Jan 2017 09:51:15 +0700 Subject: [PATCH] Use systemd module instead of shell Using ansible systemd module to daemon reload and service reload is the solution for the future. Change-Id: If2e4c74ebf8a28d5a777c404cfcc179db32de3f3 --- handlers/main.yml | 8 ++------ tasks/cinder_init_systemd.yml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 33de479d..e8ddb8b9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -13,15 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Reload systemd daemon - command: "systemctl daemon-reload" - notify: - - Restart cinder services - - name: Restart cinder services - service: + systemd: name: "{{ item.value.service_name }}" state: restarted + daemon_reload: yes with_dict: "{{ cinder_services }}" when: - inventory_hostname in groups[item.value.group] diff --git a/tasks/cinder_init_systemd.yml b/tasks/cinder_init_systemd.yml index c65d8c1d..450535b1 100644 --- a/tasks/cinder_init_systemd.yml +++ b/tasks/cinder_init_systemd.yml @@ -74,4 +74,4 @@ - inventory_hostname in groups[item.value.group] - "{{ item.value.condition | default(true) }}" notify: - - Reload systemd daemon + - Restart cinder services