ansible-edda/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.yml

34 lines
1004 B
YAML

- name: Create home dataset for user {{ service_user_name }}
zfs:
name: rpool/var/lib/{{ ansible_hostname }}/home/{{ service_user_name }}
state: present
register: user_zfs_home
- name: Populate home directory from skeleton directory
copy:
src: "/etc/skel/"
dest: "/var/lib/{{ ansible_hostname }}/home/{{ service_user_name }}"
remote_src: yes
when:
user_zfs_home is changed
- name: Create data dataset for user {{ service_user_name }}
zfs:
name: rpool/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}
state: present
extra_zfs_properties:
canmount: "off"
- name: Create service data backup dataset for user {{ service_user_name }}
zfs:
name: hpool/backup/{{ ansible_hostname }}/data/{{ service_user_name }}
state: present
extra_zfs_properties:
canmount: "off"
- include_tasks: "{{ item }}"
with_first_found:
- files:
- "01-zfs-datasets.d/{{ service_name }}.yml"
- "01-zfs-datasets.d/_default.yml"