Localise vars to user or deploy

This commit is contained in:
Wojciech Kozlowski 2022-10-30 21:20:45 +01:00
parent 2982c54d69
commit df86c2b6a8
16 changed files with 25 additions and 15 deletions

View File

@ -1,7 +1,8 @@
- block:
- import_tasks: ../vars.yml
- import_tasks: service-user/00-zfs-datasets.yml
- import_tasks: service-user/00-vars.yml
- import_tasks: service-user/01-zfs-datasets.yml
when: is_zfs
- import_tasks: service-user/00-user.yml
- import_tasks: service-user/01-veth.yml
- import_tasks: service-user/01-user.yml
- import_tasks: service-user/02-veth.yml
tags: "{{ service_name }}"

View File

@ -0,0 +1,11 @@
- name: Set service user variables
set_fact:
service_iface_name: "veth-{{ service_name }}"
service_bridge_address: "{{ services[service_name].address }}"
- name: Print service user variables
debug:
msg:
- "service_name: {{ service_name }}"
- "service_iface_name: {{ service_iface_name }}"
- "service_bridge_address: {{ service_bridge_address }}"

View File

@ -9,8 +9,8 @@
- include_tasks: "{{ item }}"
with_first_found:
- files:
- "00-user.d/shell/{{ service_name }}.yml"
- "00-user.d/shell/_default.yml"
- "01-user.d/shell/{{ service_name }}.yml"
- "01-user.d/shell/_default.yml"
- block:
@ -52,8 +52,8 @@
- include_tasks: "{{ item }}"
with_first_found:
- files:
- "00-user.d/data/{{ service_name }}.yml"
- "00-user.d/data/_default.yml"
- "01-user.d/data/{{ service_name }}.yml"
- "01-user.d/data/_default.yml"
- block:
- name: Create configuration directory for user {{ service_user_name }}

View File

@ -15,5 +15,5 @@
- include_tasks: "{{ item }}"
with_first_found:
- files:
- "00-zfs-datasets.d/{{ service_name }}.yml"
- "00-zfs-datasets.d/_default.yml"
- "01-zfs-datasets.d/{{ service_name }}.yml"
- "01-zfs-datasets.d/_default.yml"

View File

@ -39,6 +39,10 @@
when:
systemd_pod_service_files is changed
- name: Reset service_changed variable
set_fact:
service_changed: false
- include_tasks: "{{ item }}"
with_first_found:
- files:

View File

@ -1,9 +1,6 @@
- name: Set service variables
set_fact:
service_user_name: "pod-{{ service_name }}"
service_iface_name: "veth-{{ service_name }}"
service_bridge_address: "{{ services[service_name].address }}"
service_changed: false
- name: Set service variables
set_fact:
@ -18,8 +15,5 @@
msg:
- "service_name: {{ service_name }}"
- "service_user_name: {{ service_user_name }}"
- "service_iface_name: {{ service_iface_name }}"
- "service_bridge_address: {{ service_bridge_address }}"
- "service_changed: {{ service_changed }}"
- "service_home: {{ service_home }}"
- "local_service_home: {{ local_service_home }}"