ansible-edda/playbooks/roles/services/datasets/system/tasks/main.yml

59 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: "{{ services_root_dataset }}"
state: "present"
- name: "create containers zvol"
community.general.zfs:
name: "{{ services_containers_dataset }}"
state: "present"
extra_zfs_properties:
volsize: "107374182400" # 100G
refreservation: "0"
"com.sun:auto-snapshot": "false"
- name: "format containers zvol"
community.general.filesystem:
dev: "/dev/{{ services_containers_dataset }}"
fstype: "ext4"
register: services_datasets_system_zvol_format
- block:
- name: "get containers zvol uuid"
ansible.builtin.command: >-
blkid -s UUID -o value /dev/{{ services_containers_dataset }}
register: services_datasets_system_zvol_uuid
- name: "system : add fstab entry and mount containers zvol"
ansible.posix.mount:
path: "{{ services_containers_directory }}"
src: "UUID={{ services_datasets_system_zvol_uuid.stdout }}"
fstype: "ext4"
state: "mounted"
when:
services_datasets_system_zvol_format.changed
- name: "create data root dataset"
community.general.zfs:
name: "{{ services_data_dataset }}"
state: "present"
extra_zfs_properties:
canmount: "off"
- name: "create home root dataset"
community.general.zfs:
name: "{{ services_home_dataset }}"
state: "present"
extra_zfs_properties:
canmount: "off"