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

35 lines
1.2 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
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"
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 }}"
2022-12-18 23:00:28 +01:00
mode: "preserve"
2022-12-10 17:52:15 +01:00
remote_src: true
when:
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-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({}) }}"
loop: "{{ services_service_volumes | dict2items }}"