Skip to content
Snippets Groups Projects
Verified Commit a8b5e9cd authored by nd's avatar nd
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
zfs:
volumes: []
- name: install zfs
apt:
pkg:
- dkms
- spl-dkms
- zfs-dkms
- zfsutils-linux
- name: create volumes
loop: "{{ zfs.volumes|dict2items }}"
include_tasks: volume.yml
- name: create encrypted datasets
shell: "/sbin/zfs create -o encryption={{ item.value.options.encryption }} -o keyformat={{ item.value.options.keyformat }} -o keylocation={{ item.value.options.keylocation|d('') }} {{ item.key }}"
register: result
changed_when: result.rc == 0
failed_when:
- result.rc != 0
- '"dataset already exists" not in result.stderr'
when: item.value.options.encryption|default(False)
- name: create other zfs datasets and set options
community.general.zfs:
name: "{{ item.key }}"
state: present
origin: "{{ item.value.origin|d(omit) }}"
extra_zfs_properties: "{{ item.value.options|dict2items|rejectattr('key', 'eq', 'encryption')|rejectattr('key', 'eq', 'keyformat')|list|items2dict|d(omit) }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment