]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-defaults: bring backward compatibility for old syntax
authorSébastien Han <seb@redhat.com>
Tue, 10 Apr 2018 13:39:44 +0000 (15:39 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 11 Apr 2018 10:18:34 +0000 (12:18 +0200)
If people keep on using the mon_cap, osd_cap etc the playbook will
translate this old syntax on the flight.

Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-client/tasks/create_users_keys.yml
roles/ceph-defaults/tasks/facts.yml
roles/ceph-mon/tasks/main.yml

index 936e61bc40e469defca27ba9976c865580718f70..b5b012e1b77b9a31d2a2575f724ef67ad2dfb281 100644 (file)
@@ -1,4 +1,17 @@
 ---
+- name: set_fact keys_tmp - preserve backward compatibility after the introduction of the ceph_keys module
+  set_fact:
+    keys_tmp: "{{ keys_tmp|default([]) + [ { 'key': item.key, 'name': item.name, 'caps': { 'mon': item.mon_cap, 'osd': item.osd_cap|default(''), 'mds': item.mds_cap|default(''), 'mgr': item.mgr_cap|default('') } , 'mode': item.mode } ] }}"
+  when:
+    - item.get('mon_cap', None) # it's enough to assume we are running an old-fashionned syntax simply by checking the presence of mon_cap since every key needs this cap
+  with_items: "{{ keys }}"
+
+- name: set_fact keys - override keys_tmp with keys
+  set_fact:
+    keys: "{{ keys_tmp }}"
+  when:
+    - keys_tmp is defined
+
 - name: run a dummy container (sleep 300) from where we can create pool(s)/key(s)
   command: >
     docker run \
index 35264f3ce45b1172cf396a2585a35171110e02f5..e043c0ea306ad5b6d2d6df1c928c2bc2d2d69b0e 100644 (file)
   check_mode: no
   when:
     - ansible_os_family == 'RedHat'
+
+
index 3d70229d98b549baa5e513a25613b3031b22393a..30c29630df51836dba4fc9c479b775169405c9f1 100644 (file)
 - name: include set_osd_pool_default_pg_num.yml
   include: set_osd_pool_default_pg_num.yml
 
+- name: set_fact openstack_keys_tmp - preserve backward compatibility after the introduction of the ceph_keys module
+  set_fact:
+    openstack_keys_tmp: "{{ openstack_keys_tmp|default([]) + [ { 'key': item.key, 'name': item.name, 'caps': { 'mon': item.mon_cap, 'osd': item.osd_cap|default(''), 'mds': item.mds_cap|default(''), 'mgr': item.mgr_cap|default('') } , 'mode': item.mode } ] }}"
+  with_items: "{{ openstack_keys }}"
+  when:
+    - item.get('mon_cap', None) # it's enough to assume we are running an old-fashionned syntax simply by checking the presence of mon_cap since every key needs this cap
+
+- name: set_fact keys - override keys_tmp with keys
+  set_fact:
+    openstack_keys: "{{ openstack_keys_tmp }}"
+  when:
+    - openstack_keys_tmp is defined
+
 # Create the pools listed in openstack_pools
 - name: include openstack_config.yml
   include: openstack_config.yml