]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
facts: support device aliases for (dedicated|bluestore_wal)_devices
authorTyler Bishop <tbishop@liquidweb.com>
Thu, 23 Jul 2020 13:36:01 +0000 (09:36 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 29 Sep 2020 13:24:17 +0000 (09:24 -0400)
Just likve `devices`, this commit adds the support for linux device aliases for
`dedicated_devices` and `bluestore_wal_devices`.

Signed-off-by: Tyler Bishop <tbishop@liquidweb.com>
(cherry picked from commit ee4b8804ae1260a84737b7db8de2e9d2eb3a5737)

roles/ceph-facts/tasks/facts.yml

index 1bb0523d1d96081e84e834daaab295d04a6de947..aef22b97edf1bdfd6d11c71a2b0c4c9ecba4805f 100644 (file)
     - inventory_hostname in groups.get(osd_group_name, [])
     - not osd_auto_discovery | default(False) | bool
 
+- name: resolve dedicated_device link(s)
+  command: readlink -f {{ item }}
+  changed_when: false
+  check_mode: no
+  with_items: "{{ dedicated_devices }}"
+  register: dedicated_devices_prepare_canonicalize
+  when:
+    - dedicated_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
+- name: set_fact build dedicated_devices from resolved symlinks
+  set_fact:
+    dedicated_devices: "{{ dedicated_devices | default([]) + [ item.stdout ] }}"
+  with_items: "{{ dedicated_devices_prepare_canonicalize.results }}"
+  when:
+    - dedicated_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
+- name: set_fact build final dedicated_devices list
+  set_fact:
+    dedicated_devices: "{{ dedicated_devices | reject('search','/dev/disk') | list | unique }}"
+  when:
+    - dedicated_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
+- name: resolve bluestore_wal_device link(s)
+  command: readlink -f {{ item }}
+  changed_when: false
+  check_mode: no
+  with_items: "{{ bluestore_wal_devices }}"
+  register: bluestore_wal_devices_prepare_canonicalize
+  when:
+    - bluestore_wal_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
+- name: set_fact build bluestore_wal_devices from resolved symlinks
+  set_fact:
+    bluestore_wal_devices: "{{ bluestore_wal_devices | default([]) + [ item.stdout ] }}"
+  with_items: "{{ bluestore_wal_devices_prepare_canonicalize.results }}"
+  when:
+    - bluestore_wal_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
+- name: set_fact build final bluestore_wal_devices list
+  set_fact:
+    bluestore_wal_devices: "{{ bluestore_wal_devices | reject('search','/dev/disk') | list | unique }}"
+  when:
+    - bluestore_wal_devices is defined
+    - inventory_hostname in groups.get(osd_group_name, [])
+    - not osd_auto_discovery | default(False) | bool
+
 - name: set_fact devices generate device list when osd_auto_discovery
   set_fact:
     devices: "{{ (devices | default([]) + [ item.key | regex_replace('^', '/dev/') ]) | unique }}"