Skip to content

Commit

Permalink
facts: support device aliases for (dedicated|bluestore_wal)_devices
Browse files Browse the repository at this point in the history
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 ee4b880)
  • Loading branch information
Tyler Bishop authored and dsavineau committed Sep 29, 2020
1 parent 6294244 commit e3284b2
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions roles/ceph-facts/tasks/facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,62 @@
- 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 }}"
Expand Down

0 comments on commit e3284b2

Please sign in to comment.