]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-docker-common: detect ceph version 1822/head
authorSébastien Han <seb@redhat.com>
Mon, 28 Aug 2017 21:23:36 +0000 (23:23 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 28 Aug 2017 21:28:47 +0000 (23:28 +0200)
By detecting the ceph version running in the container we can easily
apply conditions like:
ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous

We do that already, in ceph-docker-common/tasks/fetch_configs.yml.

This fixes the error:

TASK [ceph-docker-common : register rbd bootstrap key]
******************************************************

fatal: [magna005]: FAILED! => {"failed": true, "msg": "The conditional
check 'ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous'
failed. The error was: error while evaluating conditional
(ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous):
'dict object' has no attribute 'dummy'\n\nThe error appears to have been
in
'/home/ubuntu/ceph-ansible/roles/ceph-docker-common/tasks/fetch_configs.yml':
line 2, column 3, but may\nbe elsewhere in the file depending on the
exact syntax problem.\n\nThe offending line appears to be:\n\n---\n-
name: register rbd bootstrap key\n  ^ here\n"}

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1486062
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-docker-common/tasks/main.yml
roles/ceph-docker-common/tasks/release.yml [new file with mode: 0644]

index 3701fd90ef40672b866cca41ef236bc47cab6f18..9c16f5d62c7634fc18047743f2ef94de5612928d 100644 (file)
     - ceph_health.rc != 0
     - not "{{ rolling_update | default(false) }}"
 
-- include: "./misc/ntp_atomic.yml"
+- include: ./misc/ntp_atomic.yml
   when:
     - is_atomic
     - ansible_os_family == 'RedHat'
     - ntp_service_enabled
 
-- include: "./misc/ntp_redhat.yml"
+- include: ./misc/ntp_redhat.yml
   when:
     - not is_atomic
     - ansible_os_family == 'RedHat'
     - ntp_service_enabled
 
-- include: "./misc/ntp_debian.yml"
+- include: ./misc/ntp_debian.yml
   when:
     - ansible_os_family == 'Debian'
     - ntp_service_enabled
 
-- include: "./fetch_image.yml"
+- include: fetch_image.yml
+
+- name: get ceph version
+  command: docker run --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version
+  changed_when: false
+  always_run: yes
+  register: ceph_version
+
+- set_fact:
+    ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
+
+- include: release.yml
 
 # NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
 # # because it creates the directories needed by the latter.
-- include: ./dirs_permissions.yml
+- include: dirs_permissions.yml
 
 - include: create_configs.yml
 
diff --git a/roles/ceph-docker-common/tasks/release.yml b/roles/ceph-docker-common/tasks/release.yml
new file mode 100644 (file)
index 0000000..f8301ca
--- /dev/null
@@ -0,0 +1,13 @@
+---
+- set_fact:
+    ceph_release: jewel
+  when: ceph_version.split('.')[0] | version_compare('10', '==')
+
+- set_fact:
+    ceph_release: kraken
+  when: ceph_version.split('.')[0] | version_compare('11', '==')
+
+- set_fact:
+    ceph_release: luminous
+  when: ceph_version.split('.')[0] | version_compare('12', '==')
+