]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Set init_system fact and reference in ceph-osd role 755/head
authorMatt Thompson <mattt@defunct.ca>
Wed, 4 May 2016 10:47:24 +0000 (11:47 +0100)
committerMatt Thompson <mattt@defunct.ca>
Wed, 4 May 2016 11:05:31 +0000 (12:05 +0100)
The ceph-osd role currently uses ansible_service_mgr, which is a fact
only available on ansible 2.x and greater.  This commit sets a similar
fact called init_system which will store the contents of /proc/1/comm
(systemd, init, etc.) and then references it ceph-osd instead.

Closes #741

roles/ceph-common/tasks/facts.yml
roles/ceph-osd/tasks/scenarios/osd_directory.yml

index 240305b554b60b55afd936c11190c1444cb6dd7c..14367819a5fe052016b8ae0319f5061d957a3b17 100644 (file)
@@ -8,6 +8,15 @@
 - set_fact:
     ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
 
+# NOTE(mattt): On ansible 2.x we can use ansible_service_mgr instead
+- name: check init system
+  slurp:
+    src: /proc/1/comm
+  register: init_system
+
+- set_fact:
+    init_system={{ init_system.content | b64decode }}
+
 # 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...
index 432f6587214ca5e3b14eabd849e8493b391bb43f..a7447948eaeb25c777841fa8005fe24d52c59a9f 100644 (file)
     name: ceph
     state: started
     enabled: yes
-  when: ansible_service_mgr != "systemd"
+  when: init_system != "systemd"
 
 - name: start and add the OSD target to the systemd sequence
   service:
     name: ceph.target
     state: started
     enabled: yes
-  when: ansible_service_mgr == "systemd"
+  when: init_system == "systemd"