Auto Merge of PR 3 - swag-config-additions_2025-08-31T07-14-27
Merged by Trez.One
This commit was merged in pull request #3.
This commit is contained in:
@@ -10,6 +10,7 @@ on:
|
|||||||
- 'inventory/hosts.yml'
|
- 'inventory/hosts.yml'
|
||||||
- 'host_vars/**'
|
- 'host_vars/**'
|
||||||
- 'group_vars/**'
|
- 'group_vars/**'
|
||||||
|
- '**/tar-valon_config_deploy.yml'
|
||||||
- '**/gitea_tar-valon_ansible_deploy.yml'
|
- '**/gitea_tar-valon_ansible_deploy.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -10,21 +10,48 @@
|
|||||||
# template_base_path and vault_addr from group_vars/all.yml
|
# template_base_path and vault_addr from group_vars/all.yml
|
||||||
# appdata_base_path, secrets_path, vault_token_cleaned from host_vars/<host>.yml
|
# appdata_base_path, secrets_path, vault_token_cleaned from host_vars/<host>.yml
|
||||||
|
|
||||||
tasks:
|
pre_tasks:
|
||||||
- name: Find all files for this host
|
- name: Find all files for this host
|
||||||
ansible.builtin.find:
|
ansible.builtin.find:
|
||||||
paths: "{{ template_base_path }}/{{ inventory_hostname }}"
|
paths: "{{ template_base_path }}/{{ inventory_hostname }}"
|
||||||
recurse: yes
|
recurse: true
|
||||||
register: host_files
|
register: host_files
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
run_once: true
|
run_once: true
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Build list of unique destination directories
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
dest_dirs: >-
|
||||||
|
{{
|
||||||
|
host_files.files
|
||||||
|
| map(attribute='path')
|
||||||
|
| map('relpath', template_base_path ~ '/' ~ inventory_hostname)
|
||||||
|
| map('dirname')
|
||||||
|
| map('regex_replace', '^(.*)$', appdata_base_path ~ '/\1')
|
||||||
|
| unique
|
||||||
|
| list
|
||||||
|
}}
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Ensure destination directories exist (unique set)
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
loop: "{{ dest_dirs }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item }}"
|
||||||
|
|
||||||
- name: Deploy Jinja2 templates (skip unchanged)
|
- name: Deploy Jinja2 templates (skip unchanged)
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path + '/' + inventory_hostname) | regex_replace('\\.j2$', '') }}"
|
dest: >-
|
||||||
|
{{ appdata_base_path }}/{{ item.path
|
||||||
|
| relpath(template_base_path ~ '/' ~ inventory_hostname)
|
||||||
|
| regex_replace('\.j2$', '') }}
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
create_dirs: yes
|
|
||||||
loop: "{{ host_files.files }}"
|
loop: "{{ host_files.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
@@ -33,10 +60,11 @@
|
|||||||
- name: Deploy static files (skip unchanged)
|
- name: Deploy static files (skip unchanged)
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path + '/' + inventory_hostname) }}"
|
dest: >-
|
||||||
|
{{ appdata_base_path }}/{{ item.path
|
||||||
|
| relpath(template_base_path ~ '/' ~ inventory_hostname) }}
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
remote_src: no
|
remote_src: false
|
||||||
create_dirs: yes
|
|
||||||
loop: "{{ host_files.files }}"
|
loop: "{{ host_files.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user