Move service directories to /etc/the-nine-worlds

This commit is contained in:
Wojciech Kozlowski 2023-09-30 23:42:51 +02:00
parent 2e4ba59aaf
commit 599dd490ee
5 changed files with 35 additions and 41 deletions

View File

@ -41,7 +41,6 @@ system_base_unattended_upgrades_blacklist:
system_var_root_directory: "/var/lib/yggdrasil"
system_var_root_dataset: "rpool{{ system_var_root_directory }}"
system_var_home_dataset: "rpool{{ system_var_home_directory }}"
system_var_data_dataset: "rpool{{ system_var_data_directory }}"
system_var_containers_dataset: "rpool{{ system_var_containers_directory }}"
@ -138,7 +137,6 @@ music_user_nextcloud_videos_pswd: "{{ vault_music_user_nextcloud_videos_pswd }}"
# services
# --------------------------------------------------------------------------------------------------
services_root_dataset: "{{ system_var_root_dataset }}"
services_home_dataset: "{{ system_var_home_dataset }}"
services_data_dataset: "{{ system_var_data_dataset }}"
services_containers_dataset: "{{ system_var_containers_dataset }}"

View File

@ -13,10 +13,7 @@ argument_specs:
required: true
services_home_dataset:
type: "str"
required: true
required: false
services_data_dataset:
type: "str"
required: true
services_home_directory:
type: "str"
required: true
required: false

View File

@ -4,31 +4,40 @@
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
- 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
- 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
services_home_dataset is defined
- 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"
- 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"
- 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 }}"
- 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 }}"
when:
services_data_dataset is defined

View File

@ -8,9 +8,6 @@ argument_specs:
system_var_root_dataset:
type: "str"
required: true
system_var_home_dataset:
type: "str"
required: true
system_var_data_dataset:
type: "str"
required: true

View File

@ -46,10 +46,3 @@
state: "present"
extra_zfs_properties:
canmount: "off"
- name: "var : create home root dataset"
community.general.zfs:
name: "{{ system_var_home_dataset }}"
state: "present"
extra_zfs_properties:
canmount: "off"