ansible/roles/bhyve-storage/tasks/main.yml
2020-09-14 01:25:20 +02:00

42 lines
1.2 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: Create common bhyve datasets
zfs:
name: '{{ bhyve_pool }}/{{ item.name }}'
state: present
extra_zfs_properties: '{{ item.properties | default(omit) }}'
loop_control:
label: '{{ item.name }}'
with_items:
- name: bhyve
properties:
mountpoint: /bhyve
- name: bhyve/images
- name: bhyve/guests
properties:
volmode: dev
- name: Create bhyve guest datasets
zfs:
name: '{{ bhyve_pool }}/guests/{{ item.name }}'
state: present
loop_control:
label: '{{ item.name }}'
with_items: '{{ bhyve_guests }}'
- name: Gather facts over existing datasets
zfs_facts:
name: '{{ bhyve_pool }}/bhyve/guests'
recurse: yes
type: volume
- name: Create bhyve guest ZFS volumes
zfs:
name: '{{ bhyve_pool}}/bhyve/guests/{{ item.0.name }}/{{ item.1.name }}'
state: present
extra_zfs_properties: '{{ item.1.properties }}'
when: 'ansible_zfs_datasets | selectattr("name", "equalto", [bhyve_pool, "bhyve/guests", item.0.name, item.1.name] | join("/") ) | list | length < 1'
loop_control:
label: '{{ item.0.name }} : {{ item.1.name }}'
with_subelements:
- '{{ bhyve_guests }}'
- disks