From b82f4edb385db14e1f5db4d0bc154b44dfffaad7 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Tue, 6 Jul 2021 11:52:10 -0400 Subject: [PATCH] Revert "ceph-facts: move device facts to its own file" This reverts commit 9f1ec38bbf9fbc341f53c080f6cec7a268cc13b1. Signed-off-by: Dimitri Savineau --- roles/ceph-facts/tasks/devices.yml | 88 -------------------------- roles/ceph-facts/tasks/facts.yml | 99 +++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 91 deletions(-) delete mode 100644 roles/ceph-facts/tasks/devices.yml diff --git a/roles/ceph-facts/tasks/devices.yml b/roles/ceph-facts/tasks/devices.yml deleted file mode 100644 index ad8233a90..000000000 --- a/roles/ceph-facts/tasks/devices.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -- name: resolve device link(s) - command: readlink -f {{ item }} - changed_when: false - check_mode: no - with_items: "{{ devices }}" - register: devices_prepare_canonicalize - when: - - devices is defined - - not osd_auto_discovery | default(False) | bool - -- name: set_fact build devices from resolved symlinks - set_fact: - devices: "{{ devices | default([]) + [ item.stdout ] }}" - with_items: "{{ devices_prepare_canonicalize.results }}" - when: - - devices is defined - - not osd_auto_discovery | default(False) | bool - -- name: set_fact build final devices list - set_fact: - devices: "{{ devices | reject('search','/dev/disk') | list | unique }}" - when: - - devices is defined - - 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 - - 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 - - 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 - - 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 - - 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 - - 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 - - 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 }}" - with_dict: "{{ ansible_facts['devices'] }}" - when: - - osd_auto_discovery | default(False) | bool - - ansible_facts['devices'] is defined - - item.value.removable == "0" - - item.value.sectors != "0" - - item.value.partitions|count == 0 - - item.value.holders|count == 0 - - item.key is not match osd_auto_discovery_exclude diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index ecb501e99..d968c0c99 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -199,9 +199,102 @@ mds_name: "{{ ansible_facts['fqdn'] }}" when: mds_use_fqdn | bool -- name: import_tasks devices.yml - import_tasks: devices.yml - when: inventory_hostname in groups.get(osd_group_name, []) +- name: resolve device link(s) + command: readlink -f {{ item }} + changed_when: false + check_mode: no + with_items: "{{ devices }}" + register: devices_prepare_canonicalize + when: + - devices is defined + - inventory_hostname in groups.get(osd_group_name, []) + - not osd_auto_discovery | default(False) | bool + +- name: set_fact build devices from resolved symlinks + set_fact: + devices: "{{ devices | default([]) + [ item.stdout ] }}" + with_items: "{{ devices_prepare_canonicalize.results }}" + when: + - devices is defined + - inventory_hostname in groups.get(osd_group_name, []) + - not osd_auto_discovery | default(False) | bool + +- name: set_fact build final devices list + set_fact: + devices: "{{ devices | reject('search','/dev/disk') | list | unique }}" + when: + - devices is defined + - 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 }}" + with_dict: "{{ ansible_facts['devices'] }}" + when: + - osd_auto_discovery | default(False) | bool + - ansible_facts['devices'] is defined + - item.value.removable == "0" + - item.value.sectors != "0" + - item.value.partitions|count == 0 + - item.value.holders|count == 0 + - item.key is not match osd_auto_discovery_exclude - name: backward compatibility tasks related when: