From df86c2b6a81704c996ff5f5278674795b166e776 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 30 Oct 2022 21:20:45 +0100 Subject: [PATCH] Localise vars to user or deploy --- playbooks/tasks/services/b-user/service-user.yml | 7 ++++--- .../tasks/services/b-user/service-user/00-vars.yml | 11 +++++++++++ .../{00-user.d => 01-user.d}/data/_default.yml | 0 .../{00-user.d => 01-user.d}/data/database.yml | 0 .../{00-user.d => 01-user.d}/data/lrproxy.yml | 0 .../{00-user.d => 01-user.d}/data/rproxy.yml | 0 .../{00-user.d => 01-user.d}/shell/_default.yml | 0 .../{00-user.d => 01-user.d}/shell/rproxy.yml | 0 .../b-user/service-user/{00-user.yml => 01-user.yml} | 8 ++++---- .../_default.yml | 0 .../database.yml | 0 .../lrproxy.yml | 0 .../{00-zfs-datasets.yml => 01-zfs-datasets.yml} | 4 ++-- .../b-user/service-user/{01-veth.yml => 02-veth.yml} | 0 .../services/c-deploy/service-deploy/service.yml | 4 ++++ playbooks/tasks/services/vars.yml | 6 ------ 16 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 playbooks/tasks/services/b-user/service-user/00-vars.yml rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/data/_default.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/data/database.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/data/lrproxy.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/data/rproxy.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/shell/_default.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.d => 01-user.d}/shell/rproxy.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-user.yml => 01-user.yml} (94%) rename playbooks/tasks/services/b-user/service-user/{00-zfs-datasets.d => 01-zfs-datasets.d}/_default.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-zfs-datasets.d => 01-zfs-datasets.d}/database.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-zfs-datasets.d => 01-zfs-datasets.d}/lrproxy.yml (100%) rename playbooks/tasks/services/b-user/service-user/{00-zfs-datasets.yml => 01-zfs-datasets.yml} (83%) rename playbooks/tasks/services/b-user/service-user/{01-veth.yml => 02-veth.yml} (100%) diff --git a/playbooks/tasks/services/b-user/service-user.yml b/playbooks/tasks/services/b-user/service-user.yml index 199892c..073fce7 100644 --- a/playbooks/tasks/services/b-user/service-user.yml +++ b/playbooks/tasks/services/b-user/service-user.yml @@ -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 }}" diff --git a/playbooks/tasks/services/b-user/service-user/00-vars.yml b/playbooks/tasks/services/b-user/service-user/00-vars.yml new file mode 100644 index 0000000..5500e37 --- /dev/null +++ b/playbooks/tasks/services/b-user/service-user/00-vars.yml @@ -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 }}" diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/data/_default.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/_default.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/data/_default.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/data/_default.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/data/database.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/data/database.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/data/lrproxy.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/data/lrproxy.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/data/rproxy.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/data/rproxy.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/shell/_default.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/shell/_default.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/shell/_default.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/shell/_default.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.d/shell/rproxy.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/shell/rproxy.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-user.d/shell/rproxy.yml rename to playbooks/tasks/services/b-user/service-user/01-user.d/shell/rproxy.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-user.yml b/playbooks/tasks/services/b-user/service-user/01-user.yml similarity index 94% rename from playbooks/tasks/services/b-user/service-user/00-user.yml rename to playbooks/tasks/services/b-user/service-user/01-user.yml index f174b8a..99c750f 100644 --- a/playbooks/tasks/services/b-user/service-user/00-user.yml +++ b/playbooks/tasks/services/b-user/service-user/01-user.yml @@ -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 }} diff --git a/playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/_default.yml b/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/_default.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/_default.yml rename to playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/_default.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/database.yml b/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/database.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/database.yml rename to playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/database.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/lrproxy.yml b/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/lrproxy.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/00-zfs-datasets.d/lrproxy.yml rename to playbooks/tasks/services/b-user/service-user/01-zfs-datasets.d/lrproxy.yml diff --git a/playbooks/tasks/services/b-user/service-user/00-zfs-datasets.yml b/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.yml similarity index 83% rename from playbooks/tasks/services/b-user/service-user/00-zfs-datasets.yml rename to playbooks/tasks/services/b-user/service-user/01-zfs-datasets.yml index ebff1b4..95b1072 100644 --- a/playbooks/tasks/services/b-user/service-user/00-zfs-datasets.yml +++ b/playbooks/tasks/services/b-user/service-user/01-zfs-datasets.yml @@ -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" diff --git a/playbooks/tasks/services/b-user/service-user/01-veth.yml b/playbooks/tasks/services/b-user/service-user/02-veth.yml similarity index 100% rename from playbooks/tasks/services/b-user/service-user/01-veth.yml rename to playbooks/tasks/services/b-user/service-user/02-veth.yml diff --git a/playbooks/tasks/services/c-deploy/service-deploy/service.yml b/playbooks/tasks/services/c-deploy/service-deploy/service.yml index 41f2966..e9fa105 100644 --- a/playbooks/tasks/services/c-deploy/service-deploy/service.yml +++ b/playbooks/tasks/services/c-deploy/service-deploy/service.yml @@ -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: diff --git a/playbooks/tasks/services/vars.yml b/playbooks/tasks/services/vars.yml index 5844a51..487cc5f 100644 --- a/playbooks/tasks/services/vars.yml +++ b/playbooks/tasks/services/vars.yml @@ -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 }}"