2022-12-12 23:49:20 +01:00
|
|
|
- name: "{{ services_service_name }} : set variables"
|
2022-12-10 17:52:15 +01:00
|
|
|
ansible.builtin.import_role:
|
2022-12-10 21:39:04 +01:00
|
|
|
name: "include"
|
2022-12-14 21:19:05 +01:00
|
|
|
vars_from: "user"
|
2022-12-10 17:52:15 +01:00
|
|
|
|
2022-12-12 23:49:20 +01:00
|
|
|
- name: "{{ services_service_name }} : create home dataset"
|
2022-12-10 17:52:15 +01:00
|
|
|
community.general.zfs:
|
2022-12-18 00:05:58 +01:00
|
|
|
name: "{{ services_home_dataset }}/{{ services_service_user_name }}"
|
2022-12-10 17:52:15 +01:00
|
|
|
state: "present"
|
2022-12-14 21:19:05 +01:00
|
|
|
register: services_datasets_user_zfs_home
|
2022-12-10 17:52:15 +01:00
|
|
|
|
2022-12-12 23:49:20 +01:00
|
|
|
- name: "{{ services_service_name }} : populate home dataset with skeleton"
|
2022-12-10 17:52:15 +01:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "/etc/skel/"
|
|
|
|
dest: "{{ services_service_user_home }}"
|
|
|
|
remote_src: true
|
|
|
|
when:
|
2022-12-14 21:19:05 +01:00
|
|
|
services_datasets_user_zfs_home.changed
|
2022-12-10 17:52:15 +01:00
|
|
|
|
2022-12-12 23:49:20 +01:00
|
|
|
- name: "{{ services_service_name }} : create data dataset"
|
2022-12-10 17:52:15 +01:00
|
|
|
community.general.zfs:
|
2022-12-18 00:05:58 +01:00
|
|
|
name: "{{ services_data_dataset }}/{{ services_service_user_name }}"
|
2022-12-10 17:52:15 +01:00
|
|
|
state: "present"
|
|
|
|
extra_zfs_properties:
|
|
|
|
canmount: "off"
|
|
|
|
|
2022-12-14 21:19:05 +01:00
|
|
|
- name: "{{ services_service_name }} : include volume list"
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: "include"
|
|
|
|
vars_from: "volumes"
|
|
|
|
|
2022-12-12 23:49:20 +01:00
|
|
|
- name: "{{ services_service_name }} : create volume datasets"
|
2022-12-10 17:52:15 +01:00
|
|
|
community.general.zfs:
|
2022-12-18 00:05:58 +01:00
|
|
|
name: "{{ services_data_dataset }}/{{ services_service_user_name }}/{{ item.key }}"
|
2022-12-10 17:52:15 +01:00
|
|
|
state: "present"
|
2022-12-12 23:49:20 +01:00
|
|
|
extra_zfs_properties: "{{ item.value.extra_zfs_properties | default({}) }}"
|
2022-12-14 21:19:05 +01:00
|
|
|
loop: "{{ services_volumes[services_service_name] | dict2items }}"
|