summaryrefslogtreecommitdiff
path: root/roles/storage/zfs/device/tasks/main.yml
blob: 1204da02f385cc8f2f53f5a63ed8e168d657a5c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
- name: compute full zfs device path
  set_fact:
    zfs_device_path_full: "{{ ('parent' in zfs_device) | ternary((zfs_device.parent.pool | default(''))~'/'~(zfs_device.parent.name | default('')), zfs_device.pool) }}/{{ zfs_device.name }}"

- name: create zfs volume
  zfs:
    name: "{{ zfs_device_path_full }}"
    extra_zfs_properties: "{{ zfs_device.properties | default({}) | combine({'volsize': zfs_device.size}) | dehumanize_zfs_properties }}"
    state: present

- name: export device path
  set_fact:
    storage_device_path: "/dev/zvol/{{ zfs_device_path_full }}"