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

44 lines
1.4 KiB
YAML
Raw Normal View History

2022-12-18 23:43:40 +01:00
---
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-18 19:36:21 +01:00
name: "services/include"
vars_from: "user"
2022-12-10 17:52:15 +01:00
- block:
- 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
2022-12-10 17:52:15 +01:00
when:
services_home_dataset is defined
- block:
- 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"
2022-12-10 17:52:15 +01:00
- 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 }}"
2022-12-10 17:52:15 +01:00
when:
services_data_dataset is defined