ansible-edda/playbooks/roles/system/datasets/tasks/include/var.yml

56 lines
1.6 KiB
YAML

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