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

35 lines
1.2 KiB
YAML

---
- name: "{{ services_service_name }} : set variables"
ansible.builtin.import_role:
name: "services/include"
vars_from: "user"
- name: "{{ services_service_name }} : create home dataset"
community.general.zfs:
name: "{{ services_home_dataset }}/{{ services_service_user_name }}"
state: "present"
register: services_datasets_user_zfs_home
- name: "{{ services_service_name }} : populate home dataset with skeleton"
ansible.builtin.copy:
src: "/etc/skel/"
dest: "{{ services_service_user_home }}"
mode: "preserve"
remote_src: true
when:
services_datasets_user_zfs_home.changed
- name: "{{ services_service_name }} : create data dataset"
community.general.zfs:
name: "{{ services_data_dataset }}/{{ services_service_user_name }}"
state: "present"
extra_zfs_properties:
canmount: "off"
- name: "{{ services_service_name }} : create volume datasets"
community.general.zfs:
name: "{{ services_data_dataset }}/{{ services_service_user_name }}/{{ item.key }}"
state: "present"
extra_zfs_properties: "{{ item.value.extra_zfs_properties | default({}) }}"
loop: "{{ services_service_volumes | dict2items }}"