Adds an use_systemd fact

This adds a helper fact that uses the ``init_system`` fact to determine if
we should be using systemd or not when controlling services.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
pull/758/head
Andrew Schoen 2016-05-04 12:16:27 -05:00
parent 7dd6e02b5d
commit 9eed0ea4e7
2 changed files with 12 additions and 4 deletions

View File

@ -17,7 +17,7 @@
state: restarted
when:
socket.rc == 0 and
ansible_distribution != 'Ubuntu' and
use_systemd and
mon_group_name in group_names and
is_after_hammer
@ -26,6 +26,7 @@
when:
socket.rc == 0 and
ansible_distribution == 'Ubuntu' and
not use_systemd and
mon_group_name in group_names
- name: restart ceph osds
@ -45,7 +46,7 @@
state: restarted
when:
socket.rc == 0 and
ansible_distribution != 'Ubuntu' and
use_systemd and
osd_group_name in group_names and
is_after_hammer
@ -57,6 +58,7 @@
when:
socket.rc == 0 and
ansible_distribution == 'Ubuntu' and
not use_systemd and
osd_group_name in group_names
- name: restart ceph mdss on ubuntu
@ -64,6 +66,7 @@
when:
socket.rc == 0 and
ansible_distribution == 'Ubuntu' and
not use_systemd and
mds_group_name in group_names
- name: restart ceph mdss
@ -71,6 +74,7 @@
when:
socket.rc == 0 and
ansible_distribution != 'Ubuntu' and
not use_systemd and
mds_group_name in group_names and
ceph_stable and
ceph_stable_release in ceph_stable_releases
@ -81,7 +85,7 @@
state: restarted
when:
socket.rc == 0 and
ansible_distribution != 'Ubuntu' and
use_systemd and
mds_group_name in group_names and
ceph_stable and
ceph_stable_release not in ceph_stable_releases
@ -91,6 +95,7 @@
when:
socketrgw.rc == 0 and
ansible_distribution == 'Ubuntu' and
not use_systemd and
rgw_group_name in group_names
- name: restart ceph rgws
@ -115,7 +120,7 @@
state: restarted
when:
socketrgw.rc == 0 and
ansible_distribution != 'Ubuntu' and
use_systemd and
rgw_group_name in group_names and
is_after_hammer

View File

@ -17,6 +17,9 @@
- set_fact:
init_system={{ init_system.content | b64decode }}
- set_fact:
use_systemd={{ init_system == 'systemd\n' }}
# NOTE (leseb/jsaintrocc): You are supposed to quote variables
# that follow colons to avoid confusion with dicts but this
# causes issues with the boolean, so we keep this syntax styling...