From 1d0e2841a792520e1c0a1ca6942c1a72c835efce Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Mon, 23 Jan 2017 16:34:46 +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: Ice457ab51c6d781024f2903e47deba48cfdbe352 --- handlers/main.yml | 9 ++------- tasks/designate_init_systemd.yml | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 9a97872..c4a17f1 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -13,15 +13,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -- name: Reload systemd daemon - command: "systemctl daemon-reload" - notify: - - Restart designate services - - name: Restart designate services - service: + systemd: name: "{{ item.value.service_name }}" state: "restarted" + daemon_reload: yes with_dict: "{{ designate_services }}" when: inventory_hostname in groups[item.value.group] diff --git a/tasks/designate_init_systemd.yml b/tasks/designate_init_systemd.yml index ad3c95d..e842339 100644 --- a/tasks/designate_init_systemd.yml +++ b/tasks/designate_init_systemd.yml @@ -53,4 +53,4 @@ with_dict: "{{ designate_services }}" when: inventory_hostname in groups[item.value.group] notify: - - Reload systemd daemon + - Restart designate services