ansible-edda/playbooks/roles/services/datasets/system/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:
2022-12-18 00:05:58 +01:00
name: "{{ services_root_dataset }}"
2022-12-10 17:52:15 +01:00
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:
2022-12-18 00:05:58 +01:00
name: "{{ services_containers_dataset }}"
2022-12-10 17:52:15 +01:00
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:
2022-12-18 00:05:58 +01:00
dev: "/dev/{{ services_containers_dataset }}"
2022-12-10 17:52:15 +01:00
fstype: "ext4"
register: services_datasets_system_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: >-
2022-12-18 00:05:58 +01:00
blkid -s UUID -o value /dev/{{ services_containers_dataset }}
register: services_datasets_system_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:
2022-12-18 00:05:58 +01:00
path: "{{ services_containers_directory }}"
src: "UUID={{ services_datasets_system_zvol_uuid.stdout }}"
2022-12-10 17:52:15 +01:00
fstype: "ext4"
state: "mounted"
when:
services_datasets_system_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:
2022-12-18 00:05:58 +01:00
name: "{{ services_data_dataset }}"
2022-12-10 17:52:15 +01:00
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:
2022-12-18 00:05:58 +01:00
name: "{{ services_home_dataset }}"
2022-12-10 17:52:15 +01:00
state: "present"
extra_zfs_properties:
canmount: "off"