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

58 lines
1.6 KiB
YAML
Raw Normal View History

2022-12-12 23:49:20 +01:00
- name: "create containers dataset"
2022-12-10 17:52:15 +01:00
community.general.zfs:
name: "rpool/var/lib/containers"
state: "present"
extra_zfs_properties:
"com.sun:auto-snapshot": "false"
2022-12-12 23:49:20 +01:00
- name: "create services root dataset"
2022-12-10 17:52:15 +01:00
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}"
state: "present"
2022-12-12 23:49:20 +01:00
- name: "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-12 23:49:20 +01:00
- name: "format containers zvol"
2022-12-10 17:52:15 +01:00
community.general.filesystem:
dev: "/dev/rpool/var/lib/{{ ansible_hostname }}/containers"
fstype: "ext4"
2022-12-13 00:19:39 +01:00
register: services_system_datasets_zvol_format
2022-12-10 17:52:15 +01:00
- block:
2022-12-12 23:49:20 +01:00
- name: "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
2022-12-13 00:19:39 +01:00
register: services_system_datasets_zvol_uuid
2022-12-10 17:52:15 +01:00
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"
2022-12-13 00:19:39 +01:00
src: "UUID={{ services_system_datasets_zvol_uuid.stdout }}"
2022-12-10 17:52:15 +01:00
fstype: "ext4"
state: "mounted"
when:
2022-12-13 00:19:39 +01:00
services_system_datasets_zvol_format.changed
2022-12-10 17:52:15 +01:00
2022-12-12 23:49:20 +01:00
- name: "create data root dataset"
2022-12-10 17:52:15 +01:00
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}/data"
state: "present"
extra_zfs_properties:
canmount: "off"
2022-12-12 23:49:20 +01:00
- name: "create home root dataset"
2022-12-10 17:52:15 +01:00
community.general.zfs:
name: "rpool/var/lib/{{ ansible_hostname }}/home"
state: "present"
extra_zfs_properties:
canmount: "off"