facts: avoid duplicated element in devices list

When using `osd_auto_discovery`, `devices` is built multiple times due
to multiple runs of `ceph-facts` role. It end up with duplicate
instances of a same device in the list.

Using `unique` filter when building the list fixes this issue.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4788/head
Guillaume Abrioux 2019-11-20 11:02:49 +01:00
parent cc0c1ce301
commit 23b1f43897
1 changed files with 1 additions and 1 deletions

View File

@ -181,7 +181,7 @@
- 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/') ] }}" devices: "{{ (devices | default([]) + [ item.key | regex_replace('^', '/dev/') ]) | unique }}"
with_dict: "{{ ansible_devices }}" with_dict: "{{ ansible_devices }}"
when: when:
- osd_auto_discovery | default(False) | bool - osd_auto_discovery | default(False) | bool