Pipeline fixes for rendering and pushing.
Auto-Unseal for Vault / Unseal Vault (push) Failing after 13m13s

This commit is contained in:
2025-06-21 20:57:56 -04:00
parent cfcd049eca
commit 6b5675803c
+34 -24
View File
@@ -3,40 +3,50 @@
vars: vars:
appdata_base_path: "~/.docker/config/appdata" appdata_base_path: "~/.docker/config/appdata"
template_base_path: "{{ playbook_dir }}/app-configs" template_base_path: "{{ playbook_dir }}/app-configs"
local_render_dir: "/tmp/rendered_templates" # Temp directory on control node
tasks: tasks:
- name: Ensure local render directory exists
ansible.builtin.file:
path: "{{ local_render_dir }}"
state: directory
mode: '0755'
delegate_to: localhost
run_once: true
- name: Recursively collect all Jinja2 templates (*.j2) - name: Recursively collect all Jinja2 templates (*.j2)
ansible.builtin.find: ansible.builtin.find:
paths: "{{ template_base_path }}" paths: "{{ template_base_path }}"
patterns: "*.j2" patterns: "*.j2"
recurse: true recurse: true
register: template_files register: template_files
delegate_to: localhost
run_once: true
- name: Set relative template path (without .j2) for each file - name: Render templates locally
ansible.builtin.set_fact: ansible.builtin.template:
rel_template_path: >- src: "{{ item.path }}"
{{ item.path dest: "{{ local_render_dir }}/{{ item.path | regex_replace('^' + (template_base_path | regex_escape) + '/', '') | regex_replace('\\.j2$', '') }}"
| regex_replace('^' + (template_base_path | regex_escape) + '/', '') mode: '0644'
| regex_replace('\\.j2$', '') }} loop: "{{ template_files.files }}"
delegate_to: localhost
loop_control:
label: "{{ item.path | basename }}"
run_once: true
- name: Copy rendered templates to remote host
ansible.builtin.copy:
src: "{{ local_render_dir }}/{{ item.path | regex_replace('^' + (template_base_path | regex_escape) + '/', '') | regex_replace('\\.j2$', '') }}"
dest: "{{ appdata_base_path }}/{{ item.path | regex_replace('^' + (template_base_path | regex_escape) + '/', '') | regex_replace('\\.j2$', '') }}"
mode: '0644'
loop: "{{ template_files.files }}" loop: "{{ template_files.files }}"
loop_control: loop_control:
loop_var: item label: "{{ item.path | basename }}"
register: rel_paths
- name: Ensure target directories exist - name: Clean up local render directory
ansible.builtin.file: ansible.builtin.file:
path: "{{ appdata_base_path }}/{{ item.ansible_facts.rel_template_path | dirname }}" path: "{{ local_render_dir }}"
state: directory state: absent
mode: '0755' delegate_to: localhost
loop: "{{ rel_paths.results }}" run_once: true
loop_control:
label: "{{ item.ansible_facts.rel_template_path }}"
- name: Deploy rendered templates
ansible.builtin.template:
src: "{{ item.item.path | regex_replace('^' + (playbook_dir | regex_escape) + '/', '') }}"
dest: "{{ appdata_base_path }}/{{ item.ansible_facts.rel_template_path }}"
mode: '0644'
loop: "{{ rel_paths.results }}"
loop_control:
label: "{{ item.ansible_facts.rel_template_path }}"