]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-common: create a facts task to define ceph versions
authorAlfredo Deza <adeza@redhat.com>
Wed, 27 Apr 2016 13:17:56 +0000 (09:17 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 27 Apr 2016 14:21:16 +0000 (10:21 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
roles/ceph-common/tasks/facts.yml [new file with mode: 0644]

diff --git a/roles/ceph-common/tasks/facts.yml b/roles/ceph-common/tasks/facts.yml
new file mode 100644 (file)
index 0000000..bb90e5f
--- /dev/null
@@ -0,0 +1,36 @@
+---
+
+- name: get ceph version
+  command: ceph --version
+  changed_when: false
+  register: ceph_version
+
+- set_fact:
+    ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
+
+# 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...
+- set_fact:
+    is_after_hammer={{ ceph_version | version_compare('0.95.0', '>') }}
+
+- set_fact:
+    is_after_infernalis={{ ceph_version | version_compare('9.4.0', '>') }}
+
+- set_fact:
+    is_after_jewel={{ ceph_version | version_compare('10.4.0', '>') }}
+
+- set_fact:
+    is_after_kraken={{ ceph_version | version_compare('11.4.0', '>') }}
+
+- set_fact:
+    is_hammer={{ ceph_version | version_compare('0.94.0', '>=') | version_compare('9.0.0', '<') }}
+
+- set_fact:
+    is_infernalis={{ ceph_version | version_compare('9.0.0', '>=') and ceph_version | version_compare('10.0.0', '<') }}
+
+- set_fact:
+    is_jewel={{ ceph_version | version_compare('10.0.0', '>=') and ceph_version | version_compare('11.0.0', '<') }}
+
+- set_fact:
+    is_kraken={{ ceph_version | version_compare('11.0.0', '>=')  and ceph_version | version_compare('12.0.0', '<') }}