]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
filestore-to-bluestore: fix py2 on skipped tasks v4.0.20
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 20 Apr 2020 13:47:31 +0000 (09:47 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 20 Apr 2020 17:38:19 +0000 (13:38 -0400)
When using skipped variables with from_json filter and python2 then we
need to have a default value otherwise the skipped task will fail.

Unexpected templating type error occurred on
({{ (ceph_volume_lvm_list.stdout | from_json) }}): expected string or
buffer

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1790472
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 2b9edba13149cdf326cbe944defbd7e05e328497)

infrastructure-playbooks/filestore-to-bluestore.yml

index 40bd6496910455f99cb74e39ec73bcb9c2e5183f..08afcd00b275435471ec398991fb48aa80afcc9a 100644 (file)
         - name: set_fact _lvm_list
           set_fact:
             _lvm_list: "{{ _lvm_list | default([]) + item.value }}"
-          with_dict: "{{ (ceph_volume_lvm_list.stdout | from_json) }}"
+          with_dict: "{{ (ceph_volume_lvm_list.stdout | default('{}') | from_json) }}"
 
         - name: ceph-volume prepared OSDs related tasks
           block:
             - name: mark out osds
               command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd out {{ item }}"
-              with_items: "{{ (ceph_volume_lvm_list.stdout | from_json).keys() | list }}"
+              with_items: "{{ (ceph_volume_lvm_list.stdout | default('{}') | from_json).keys() | list }}"
               delegate_to: "{{ groups[mon_group_name][0] }}"
               run_once: true
 
                 name: "ceph-osd@{{ item }}"
                 state: stopped
                 enabled: no
-              with_items: "{{ (ceph_volume_lvm_list.stdout | from_json).keys() | list }}"
+              with_items: "{{ (ceph_volume_lvm_list.stdout | default('{}') | from_json).keys() | list }}"
 
             - name: stop and disable ceph-volume services
               service:
 
             - name: mark down osds
               command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} osd down {{ item }}"
-              with_items: "{{ (ceph_volume_lvm_list.stdout | from_json).keys() | list }}"
+              with_items: "{{ (ceph_volume_lvm_list.stdout | default('{}') | from_json).keys() | list }}"
               delegate_to: "{{ groups[mon_group_name][0] }}"
               run_once: true
 
           set_fact:
             osd_ids: "{{ osd_ids | default([]) + [item] }}"
           with_items:
-            - "{{ ((osd_tree.stdout | from_json).nodes | selectattr('name', 'match', inventory_hostname) | map(attribute='children') | list) }}"
+            - "{{ ((osd_tree.stdout | default('{}') | from_json).nodes | selectattr('name', 'match', inventory_hostname) | map(attribute='children') | list) }}"
 
 
         - name: purge osd(s) from the cluster