diff options
Diffstat (limited to 'roles/storage/mdadm/device/tasks')
-rw-r--r-- | roles/storage/mdadm/device/tasks/main.yml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/storage/mdadm/device/tasks/main.yml b/roles/storage/mdadm/device/tasks/main.yml new file mode 100644 index 00000000..338f26f7 --- /dev/null +++ b/roles/storage/mdadm/device/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: create array + command: "mdadm --create /dev/md/{{ mdadm_device.name }} --metadata default --level {{ mdadm_device.level }} --raid-devices {{ mdadm_device.devices | length }} {{ mdadm_device.devices | join(' ') }}" + args: + creates: "/dev/md/{{ mdadm_device.name }}" + +- name: fetch UUID of array + command: "mdadm --detail --scan /dev/md/{{ mdadm_device.name }}" + changed_when: false + check_mode: no + register: mdadm_device_uuid + +- name: udpate mdadm.conf + lineinfile: + path: /etc/mdadm/mdadm.conf + regexp: '^ARRAY /dev/md/{{ mdadm_device.name }} ' + line: "{{ mdadm_device_uuid.stdout_lines | first }}" + insertafter: "# definitions of existing MD arrays" + notify: rebuild initramfs + +- name: export device path + set_fact: + storage_device_path: "/dev/md/{{ mdadm_device.name }}" |