2022-10-02 14:56:43 +02:00
|
|
|
- name: Create service dataset
|
|
|
|
zfs:
|
|
|
|
name: rpool/var/lib/{{ ansible_hostname }}
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create a zvol for containers
|
|
|
|
zfs:
|
|
|
|
name: rpool/var/lib/{{ ansible_hostname }}/containers
|
|
|
|
state: present
|
|
|
|
extra_zfs_properties:
|
|
|
|
volsize: "100G"
|
|
|
|
refreservation: "none"
|
2022-10-10 20:44:12 +02:00
|
|
|
"com.sun:auto-snapshot": "false"
|
2022-10-02 14:56:43 +02:00
|
|
|
|
|
|
|
- name: Format zvol with ext4
|
|
|
|
filesystem:
|
|
|
|
dev: /dev/rpool/var/lib/{{ ansible_hostname }}/containers
|
|
|
|
fstype: ext4
|
|
|
|
register: zvol_format
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Get UUID of zvol
|
|
|
|
command: blkid -s UUID -o value /dev/rpool/var/lib/{{ ansible_hostname }}/containers
|
|
|
|
register: zvol_uuid
|
|
|
|
|
|
|
|
- name: Add fstab entry and mount zvol
|
|
|
|
mount:
|
|
|
|
path: /var/lib/{{ ansible_hostname }}/containers
|
|
|
|
src: UUID={{ zvol_uuid.stdout }}
|
|
|
|
fstype: ext4
|
|
|
|
state: mounted
|
|
|
|
|
|
|
|
when:
|
|
|
|
zvol_format is changed
|
|
|
|
|
|
|
|
- name: Create service data dataset
|
|
|
|
zfs:
|
|
|
|
name: rpool/var/lib/{{ ansible_hostname }}/data
|
|
|
|
state: present
|
|
|
|
extra_zfs_properties:
|
|
|
|
canmount: "off"
|
|
|
|
|
|
|
|
- name: Create service home dataset
|
|
|
|
zfs:
|
|
|
|
name: rpool/var/lib/{{ ansible_hostname }}/home
|
|
|
|
state: present
|
|
|
|
extra_zfs_properties:
|
|
|
|
canmount: "off"
|
2022-10-14 21:32:51 +02:00
|
|
|
|
|
|
|
- name: Create backup dataset
|
|
|
|
zfs:
|
|
|
|
name: hpool/backup
|
|
|
|
state: present
|
|
|
|
extra_zfs_properties:
|
|
|
|
canmount: "off"
|
|
|
|
"com.sun:auto-snapshot": "false"
|
|
|
|
|
|
|
|
- name: Create service backup dataset
|
|
|
|
zfs:
|
|
|
|
name: hpool/backup/{{ ansible_hostname }}
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create service data backup dataset
|
|
|
|
zfs:
|
|
|
|
name: hpool/backup/{{ ansible_hostname }}/data
|
|
|
|
state: present
|
|
|
|
extra_zfs_properties:
|
|
|
|
canmount: "off"
|