5bf0123aa3
Gitea Branch PR & Ansible Deployment / Check and Create PR (push) Successful in 21s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m28s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m28s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m28s
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
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
---
|
|
- name: Deploy Docker Service Configurations (Optimized & Vault-ready)
|
|
hosts:
|
|
- rinoa
|
|
- rikku
|
|
- benedikta
|
|
gather_facts: false
|
|
|
|
vars:
|
|
template_base_path: "{{ playbook_dir }}/../app-configs"
|
|
|
|
pre_tasks:
|
|
- name: Gather all files for each host (on localhost)
|
|
ansible.builtin.find:
|
|
paths: "{{ template_base_path }}/{{ item }}"
|
|
recurse: true
|
|
loop: "{{ ansible_play_hosts }}"
|
|
loop_control:
|
|
loop_var: item
|
|
register: files_per_host
|
|
delegate_to: localhost
|
|
changed_when: false
|
|
|
|
tasks:
|
|
- name: Set host_files for this host
|
|
set_fact:
|
|
host_files: >-
|
|
{{
|
|
files_per_host.results
|
|
| selectattr('item','equalto',inventory_hostname)
|
|
| map(attribute='files')
|
|
| first
|
|
}}
|
|
|
|
- name: Build list of unique destination directories for this host
|
|
set_fact:
|
|
dest_dirs: >-
|
|
{{
|
|
host_files
|
|
| map(attribute='path')
|
|
| map('relpath', template_base_path ~ '/' ~ inventory_hostname)
|
|
| map('dirname')
|
|
| map('regex_replace', '^(.*)$', appdata_base_path ~ '/\\1')
|
|
| unique
|
|
| list
|
|
}}
|
|
|
|
- name: Ensure destination directories exist
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: '0755'
|
|
loop: "{{ dest_dirs }}"
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
|
|
- name: Deploy Jinja2 templates
|
|
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 }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
when: item.path.endswith('.j2')
|
|
|
|
- name: Deploy static files
|
|
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 }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
when: not item.path.endswith('.j2')
|