Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 7f168a4

Browse files
authored
Merge pull request DavidWittman#146 from DavidWittman/143-fix-daemon-reload
Add separate task for systemd daemon reload
2 parents 3549d83 + d592920 commit 7f168a4

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python: "2.7"
44

55
env:
66
- ANSIBLE_VERSION=1.9.4
7+
- ANSIBLE_VERSION=2.1.3
78
- ANSIBLE_VERSION=latest
89

910
before_install:

tasks/sentinel.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- default/redis_sentinel.init.j2
2020
paths:
2121
- ../templates
22-
when: redis_as_service and ansible_service_mgr|default() != 'systemd'
22+
when: redis_as_service and ansible_service_mgr|default() != "systemd"
2323

2424
- name: create sentinel systemd service
2525
template:
@@ -32,7 +32,8 @@
3232
- default/redis_sentinel.service.j2
3333
paths:
3434
- ../templates
35-
when: redis_as_service and ansible_service_mgr|default() == 'systemd'
35+
register: sentinel_unit_file
36+
when: redis_as_service and ansible_service_mgr|default() == "systemd"
3637

3738
- name: create systemd tmpfiles configuration
3839
template:
@@ -41,14 +42,20 @@
4142
mode: 0644
4243
when:
4344
- redis_as_service
44-
- ansible_service_mgr|default() == 'systemd'
45-
- (redis_sentinel_pidfile|dirname).startswith('/var/run') or (redis_sentinel_pidfile|dirname).startswith('/run')
45+
- ansible_service_mgr|default() == "systemd"
46+
- (redis_sentinel_pidfile|dirname).startswith("/var/run") or (redis_sentinel_pidfile|dirname).startswith("/run")
47+
48+
- name: reload systemd daemon
49+
command: systemctl daemon-reload
50+
when:
51+
- redis_as_service
52+
- ansible_service_mgr|default() == "systemd"
53+
- sentinel_unit_file|changed
4654

4755
- name: set sentinel to start at boot
4856
service:
4957
name: sentinel_{{ redis_sentinel_port }}
5058
enabled: yes
51-
daemon_reload: "{{ True if ansible_service_mgr|default() == 'systemd' else omit }}"
5259
when: redis_as_service
5360

5461
# Check then create log dir to prevent aggressively overwriting permissions

tasks/server.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- default/redis.init.j2
2020
paths:
2121
- ../templates
22-
when: redis_as_service and ansible_service_mgr|default() != 'systemd'
22+
when: redis_as_service and ansible_service_mgr|default() != "systemd"
2323

2424
- name: create redis systemd service
2525
template:
@@ -32,7 +32,8 @@
3232
- default/redis.service.j2
3333
paths:
3434
- ../templates
35-
when: redis_as_service and ansible_service_mgr|default() == 'systemd'
35+
register: redis_unit_file
36+
when: redis_as_service and ansible_service_mgr|default() == "systemd"
3637

3738
- name: create systemd tmpfiles configuration
3839
template:
@@ -44,11 +45,17 @@
4445
- ansible_service_mgr|default() == 'systemd'
4546
- (redis_pidfile|dirname).startswith('/var/run') or (redis_pidfile|dirname).startswith('/run')
4647

48+
- name: reload systemd daemon
49+
command: systemctl daemon-reload
50+
when:
51+
- redis_as_service
52+
- ansible_service_mgr|default() == "systemd"
53+
- redis_unit_file|changed
54+
4755
- name: set redis to start at boot
4856
service:
4957
name: "{{ redis_service_name }}"
5058
enabled: yes
51-
daemon_reload: "{{ True if ansible_service_mgr|default() == 'systemd' else omit }}"
5259
when: redis_as_service
5360

5461
# Check then create log dir to prevent aggressively overwriting permissions

0 commit comments

Comments
 (0)