From c87d755f5720c6927c0c9ac080f1c27bb25a33da Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 19 Jan 2017 11:05:05 +0000 Subject: [PATCH] Use systemd module instead of shell Using ansible systemd module to daemon reload and service reload is the solution for the future. Let's embrace it! Change-Id: I808c72fbea6353da102f4d4569b446ec9fbe8df1 Signed-off-by: Jean-Philippe Evrard --- handlers/main.yml | 10 ++++------ tasks/almanach_init_api_systemd.yml | 5 ----- tasks/almanach_init_collector_systemd.yml | 5 ----- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 617e31d..042d3b7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -14,21 +14,19 @@ # limitations under the License. - name: Restart almanach collector - service: + systemd: name: "{{ almanach_collector_program_name }}" state: "restarted" - pattern: "{{ almanach_collector_program_name }}" + daemon_reload: "yes" - name: Restart almanach api - service: + systemd: name: "{{ almanach_api_program_name }}" state: "restarted" - pattern: "{{ almanach_api_program_name }}" - name: Restart almanach services - service: + systemd: name: "{{ item }}" state: "restarted" - pattern: "{{ item }}" with_items: "{{ almanach_service_names }}" failed_when: false diff --git a/tasks/almanach_init_api_systemd.yml b/tasks/almanach_init_api_systemd.yml index a73c598..9d8ef33 100644 --- a/tasks/almanach_init_api_systemd.yml +++ b/tasks/almanach_init_api_systemd.yml @@ -20,10 +20,5 @@ mode: "0644" owner: "root" group: "root" - register: systemd_init - -- name: Reload the systemd daemon - command: "systemctl daemon-reload" - when: systemd_init | changed notify: - Restart almanach services diff --git a/tasks/almanach_init_collector_systemd.yml b/tasks/almanach_init_collector_systemd.yml index eed9129..2e39636 100644 --- a/tasks/almanach_init_collector_systemd.yml +++ b/tasks/almanach_init_collector_systemd.yml @@ -20,10 +20,5 @@ mode: "0644" owner: "root" group: "root" - register: systemd_init - -- name: Reload the systemd daemon - command: "systemctl daemon-reload" - when: systemd_init | changed notify: - Restart almanach services