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:
appdata_base_path: "~/.docker/config/appdata"
template_base_path: "{{ playbook_dir }}/app-configs"
local_render_dir: "/tmp/rendered_templates" # Temp directory on control node
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)
ansible.builtin.find:
paths: "{{ template_base_path }}"
patterns: "*.j2"
recurse: true
register: template_files
delegate_to: localhost
run_once: true
- name: Set relative template path (without .j2) for each file
ansible.builtin.set_fact:
rel_template_path: >-
{{ item.path
| regex_replace('^' + (template_base_path | regex_escape) + '/', '')
| regex_replace('\\.j2$', '') }}
- name: Render templates locally
ansible.builtin.template:
src: "{{ item.path }}"
dest: "{{ local_render_dir }}/{{ item.path | regex_replace('^' + (template_base_path | regex_escape) + '/', '') | regex_replace('\\.j2$', '') }}"
mode: '0644'
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_control:
loop_var: item
register: rel_paths
label: "{{ item.path | basename }}"
- name: Ensure target directories exist
- name: Clean up local render directory
ansible.builtin.file:
path: "{{ appdata_base_path }}/{{ item.ansible_facts.rel_template_path | dirname }}"
state: directory
mode: '0755'
loop: "{{ rel_paths.results }}"
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 }}"
path: "{{ local_render_dir }}"
state: absent
delegate_to: localhost
run_once: true