]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Adds an use_systemd fact
authorAndrew Schoen <aschoen@redhat.com>
Wed, 4 May 2016 17:16:27 +0000 (12:16 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 5 May 2016 16:53:08 +0000 (11:53 -0500)
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>
roles/ceph-common/handlers/main.yml
roles/ceph-common/tasks/facts.yml

index ca7102645e940202d247823b7e38aee27e1cf727..3b4ba2f5f8381f28c1087b1a2d90404392e63204 100644 (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
     state: restarted
   when:
     socketrgw.rc == 0 and
-    ansible_distribution != 'Ubuntu' and
+    use_systemd and
     rgw_group_name in group_names and
     is_after_hammer
 
index 14367819a5fe052016b8ae0319f5061d957a3b17..427dc804de0781823ef415e87b635ea90f9ab0d5 100644 (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...