From a8997f8cfd67ed5598bf7e5ad8f53c19947be0b0 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 21 Nov 2017 07:32:19 +0000 Subject: [PATCH] Implement consistent restart handlers Retries and daemon reloads are added to all the handlers and the ordering of each task is set out according to the same pattern as they keystone role. Change-Id: Icc250e811fb89024f3f3c2f9520d1a6c9c21f0d3 --- handlers/main.yml | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index efac334..850cfd7 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -16,35 +16,66 @@ - name: reload nginx service: name: "nginx" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 - name: reload rsyncd service: name: "{{ rsyncd_service_name }}" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 - name: reload acng service: name: "apt-cacher-ng" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 - name: reload lsyncd service: name: "lsyncd" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 - name: reload git-daemon service: name: "git-daemon" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 - name: reload git socket service: name: "git.socket" - state: restarted enabled: yes + state: restarted + daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" + register: _restart + until: _restart | success + retries: 5 + delay: 2 +