From dc50158612ffbc15f8ae1b75af575890819d09ce Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Fri, 25 Nov 2016 17:43:33 -0200 Subject: [PATCH] Explicitly run systemd module with daemon-reload when necessary The service module doesn't accept implementation-specific arguments before Ansible 2.2. --- tasks/sentinel.yml | 9 +++++++-- tasks/server.yml | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index bc7eaeb3..03478426 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -36,13 +36,18 @@ when: redis_as_service and ansible_service_mgr|default() == 'systemd' notify: restart sentinel +- name: set sentinel to start at boot (systemd) + systemd: + name: sentinel_{{ redis_sentinel_port }} + enabled: yes + daemon_reload: yes + when: redis_as_service and ansible_service_mgr|default() == 'systemd' - name: set sentinel to start at boot service: name: sentinel_{{ redis_sentinel_port }} enabled: yes - daemon_reload: "{{ True if ansible_service_mgr|default() == 'systemd' else omit }}" - when: redis_as_service + when: redis_as_service and ansible_service_mgr|default() != 'systemd' # Check then create log dir to prevent aggressively overwriting permissions - name: check if sentinel log directory exists diff --git a/tasks/server.yml b/tasks/server.yml index 67c300c3..a01ff799 100644 --- a/tasks/server.yml +++ b/tasks/server.yml @@ -36,12 +36,18 @@ when: redis_as_service and ansible_service_mgr | default == 'systemd' notify: restart redis +- name: set redis to start at boot (systemd) + systemd: + name: "{{ redis_service_name }}" + enabled: yes + daemon_reload: yes + when: redis_as_service and ansible_service_mgr | default == 'systemd' + - name: set redis to start at boot service: name: "{{ redis_service_name }}" enabled: yes - daemon_reload: "{{ True if ansible_service_mgr | default == 'systemd' else omit }}" - when: redis_as_service + when: redis_as_service and ansible_service_mgr | default != 'systemd' # Check then create log dir to prevent aggressively overwriting permissions - name: check if log directory exists