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

38 lines
1.3 KiB
YAML

- name: "{{ services_service_name }} : set variables"
ansible.builtin.import_role:
name: "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 }}"
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 }} : include volume list"
ansible.builtin.import_role:
name: "include"
vars_from: "volumes"
- 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_volumes[services_service_name] | dict2items }}"