ansible-edda/plays/services/roles/datasets/tasks/include/system.yml

58 lines
1.7 KiB
YAML
Raw Normal View History

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