ansible-edda/plays/services/roles/system_datasets/tasks/main.yml

58 lines
1.6 KiB
YAML

- name: "create containers dataset"
community.general.zfs:
name: "rpool/var/lib/containers"
state: "present"
extra_zfs_properties:
"com.sun:auto-snapshot": "false"
- name: "create services root dataset"
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}"
state: "present"
- name: "create containers zvol"
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}/containers"
state: "present"
extra_zfs_properties:
volsize: "100G"
refreservation: "none"
"com.sun:auto-snapshot": "false"
- name: "format containers zvol"
community.general.filesystem:
dev: "/dev/rpool/var/lib/{{ ansible_hostname }}/containers"
fstype: "ext4"
register: services_system_datasets_zvol_format
- block:
- name: "get containers zvol uuid"
ansible.builtin.command: >-
blkid -s UUID -o value /dev/rpool/var/lib/{{ ansible_hostname }}/containers
register: services_system_datasets_zvol_uuid
- name: "system : add fstab entry and mount containers zvol"
ansible.posix.mount:
path: "/var/lib/{{ ansible_hostname }}/containers"
src: "UUID={{ services_system_datasets_zvol_uuid.stdout }}"
fstype: "ext4"
state: "mounted"
when:
services_system_datasets_zvol_format.changed
- name: "create data root dataset"
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}/data"
state: "present"
extra_zfs_properties:
canmount: "off"
- name: "create home root dataset"
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}/home"
state: "present"
extra_zfs_properties:
canmount: "off"