]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-facts: ignore mounted disks on osd auto discovery
authorSeena Fallah <seenafallah@gmail.com>
Sat, 15 Jan 2022 16:34:03 +0000 (20:04 +0330)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 21 Feb 2022 16:15:30 +0000 (17:15 +0100)
Ignore disks with active mountpoint when osd_auto_discovery is true

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
roles/ceph-facts/tasks/devices.yml

index ad8233a905128bf0168942eb8227b1c0b13b74ef..6c4af65eca1febbd4b4b91abd4c49444a8db203f 100644 (file)
     - not osd_auto_discovery | default(False) | bool
 
 - name: set_fact devices generate device list when osd_auto_discovery
+  vars:
+    device: "{{ item.key | regex_replace('^', '/dev/') }}"
   set_fact:
-    devices: "{{ (devices | default([]) + [ item.key | regex_replace('^', '/dev/') ]) | unique }}"
+    devices: "{{ devices | default([]) | union([device]) }}"
   with_dict: "{{ ansible_facts['devices'] }}"
   when:
     - osd_auto_discovery | default(False) | bool
@@ -85,4 +87,5 @@
     - item.value.sectors != "0"
     - item.value.partitions|count == 0
     - item.value.holders|count == 0
+    - ansible_facts['mounts'] | selectattr('device', 'equalto', device) | length == 0
     - item.key is not match osd_auto_discovery_exclude