Skip to content

Commit

Permalink
Explicitly run systemd module with daemon-reload when necessary
Browse files Browse the repository at this point in the history
The service module doesn't accept implementation-specific arguments
before Ansible 2.2.
  • Loading branch information
danielkza committed Nov 25, 2016
1 parent 2717edf commit dc50158
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions tasks/sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tasks/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc50158

Please sign in to comment.