---
- name: Create mount points
  file:
    path: "{{ item.path }}"
    state: directory
    owner: "{{ item.owner | default('root') }}"
    group: "{{ item.group | default('root') }}"
    mode: "{{ item.mode | default('0750') }}"
  with_items:
    - "{{ snapraid_parity_disks }}"
    - "{{ snapraid_data_disks }}"
  loop_control:
    label: "{{ item.path }}"

- name: Ensure disks are mounted
  mount:
    path: "{{ item.path }}"
    src: "{{ item.disk }}"
    fstype: "{{ item.fs | default('xfs') }}"
    opts: "{{ item.opts | default('defaults') }}"
    state: mounted
  with_items:
    - "{{ snapraid_parity_disks }}"
    - "{{ snapraid_data_disks }}"
  loop_control:
    label: "{{ item.disk }} -> {{ item.path }}"