]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
switch-from-non-containerized-to-containerized: fix devices 1864/head
authorSébastien Han <seb@redhat.com>
Thu, 7 Sep 2017 07:16:31 +0000 (09:16 +0200)
committerSébastien Han <seb@redhat.com>
Thu, 7 Sep 2017 21:18:14 +0000 (23:18 +0200)
If devices is passed through an extra var this register won't work so
let's only register the var is devices is not defined.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1489099
Signed-off-by: Sébastien Han <seb@redhat.com>
infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml

index 3ba0ebf55b19291c042f02c18a0853d26e37c2f8..bac7da470a8f4e52b28330b5ae8223a74299b2b3 100644 (file)
     - name: collect osd devices
       shell: |
         blkid | awk '/ceph data/ { sub ("1:", "", $1); print $1 }'
-      register: devices
+      register: collect_devices
       changed_when: false
+      when:
+        - devices is not defined or (devices is defined and devices == [])
+
+    - name: set devices
+      set_fact:
+        devices: "{{ collect_devices.stdout_lines | list }}"
+      when:
+        - collect_devices is defined
+        - not collect_devices.get("skipped")
+        - collect_devices != []
 
     - name: stop non-containerized ceph osd(s)
       systemd:
         docker ps | grep -sq {{ item | regex_replace('/', '') }}
       changed_when: false
       failed_when: false
-      with_items: "{{ devices.stdout_lines }}"
+      with_items: "{{ devices }}"
       register: osd_running
 
     - name: unmount all the osd directories
       changed_when: false
       failed_when: false
       with_together:
-        - "{{ devices.stdout_lines }}"
+        - "{{ devices }}"
         - "{{ osd_running.results }}"
       when:
         - item.1.get("rc", 0) != 0
 
-    - set_fact: devices={{ devices.stdout_lines }}
-
   roles:
     - ceph-defaults
     - ceph-docker-common