facts: support device aliases for (dedicated|bluestore_wal)_devices

Just likve `devices`, this commit adds the support for linux device aliases for
`dedicated_devices` and `bluestore_wal_devices`.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1919084

Signed-off-by: Tyler Bishop <tbishop@liquidweb.com>
(cherry picked from commit ee4b8804ae)
guits-quick-test2.8
Tyler Bishop 2020-07-23 09:36:01 -04:00 committed by Guillaume Abrioux
parent e3165f9a07
commit ba76102952
1 changed files with 56 additions and 0 deletions

View File

@ -217,6 +217,62 @@
- inventory_hostname in groups.get(osd_group_name, []) - inventory_hostname in groups.get(osd_group_name, [])
- not osd_auto_discovery | default(False) | bool - 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 - name: set_fact devices generate device list when osd_auto_discovery
set_fact: set_fact:
devices: "{{ (devices | default([]) + [ item.key | regex_replace('^', '/dev/') ]) | unique }}" devices: "{{ (devices | default([]) + [ item.key | regex_replace('^', '/dev/') ]) | unique }}"