Files
tar-valon-ansible/tar-valon_config_deploy.yml
T
Trez.One bc5e3f673a
Gitea Branch PR & Ansible Deployment / Check and Create PR (push) Successful in 7s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m33s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m38s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m42s
Gitea Branch PR & Ansible Deployment / PR Merge (push) Has been skipped
Gitea Branch PR & Ansible Deployment / Ansible Config Deployment (benedikta) (push) Has been skipped
Gitea Branch PR & Ansible Deployment / Ansible Config Deployment (rikku) (push) Has been skipped
Gitea Branch PR & Ansible Deployment / Ansible Config Deployment (rinoa) (push) Has been skipped
....
2025-08-31 19:05:32 -04:00

72 lines
2.2 KiB
YAML

---
- name: Deploy Docker Service Configurations (Optimized & Vault-ready)
hosts:
- rinoa
- rikku
- benedikta
gather_facts: false
vars:
# template_base_path and vault_addr from group_vars/all.yml
# appdata_base_path, secrets_path, vault_token_cleaned from host_vars/<host>.yml
pre_tasks:
- name: Find all files for this host
ansible.builtin.find:
paths: "{{ template_base_path }}/{{ inventory_hostname }}"
recurse: true
register: host_files
delegate_to: localhost
run_once: true
changed_when: false # ensures this task never shows as "changed"
- 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('community.general.path_join', appdata_base_path)
| unique
| list
}}
changed_when: false # computing vars does not constitute a change
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)
ansible.builtin.template:
src: "{{ item.path }}"
dest: >-
{{ appdata_base_path }}/{{ item.path
| relpath(template_base_path ~ '/' ~ inventory_hostname)
| regex_replace('\.j2$', '') }}
mode: '0644'
loop: "{{ host_files.files }}"
loop_control:
label: "{{ item.path }}"
when: item.path.endswith('.j2')
- name: Deploy static files (skip unchanged)
ansible.builtin.copy:
src: "{{ item.path }}"
dest: >-
{{ appdata_base_path }}/{{ item.path
| relpath(template_base_path ~ '/' ~ inventory_hostname) }}
mode: '0644'
remote_src: false
loop: "{{ host_files.files }}"
loop_control:
label: "{{ item.path }}"
when: not item.path.endswith('.j2')