...
Gitea Branch PR & Ansible Deployment / Check and Create PR (push) Successful in 13s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m10s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m12s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m12s
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
Gitea Branch PR & Ansible Deployment / Check and Create PR (push) Successful in 13s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m10s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m12s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m12s
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
This commit is contained in:
@@ -10,30 +10,21 @@
|
|||||||
template_base_path: "{{ playbook_dir }}/../app-configs"
|
template_base_path: "{{ playbook_dir }}/../app-configs"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Find all files for each host (on localhost)
|
- name: Gather files for all hosts (on localhost)
|
||||||
ansible.builtin.find:
|
find:
|
||||||
paths: "{{ template_base_path }}/{{ item }}"
|
paths: "{{ template_base_path }}/{{ item }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: item
|
loop_var: item
|
||||||
register: host_files_results
|
register: files_per_host
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Set host_files fact for this host
|
tasks:
|
||||||
set_fact:
|
- name: Deploy files to each host
|
||||||
host_files: >-
|
vars:
|
||||||
{{
|
host_files: "{{ files_per_host.results | selectattr('item','equalto',inventory_hostname) | map(attribute='files') | first }}"
|
||||||
host_files_results.results
|
|
||||||
| selectattr('item','equalto',inventory_hostname)
|
|
||||||
| map(attribute='files')
|
|
||||||
| first
|
|
||||||
}}
|
|
||||||
run_once: false
|
|
||||||
|
|
||||||
- name: Build list of unique destination directories per host
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
dest_dirs: >-
|
dest_dirs: >-
|
||||||
{{
|
{{
|
||||||
host_files
|
host_files
|
||||||
@@ -44,39 +35,27 @@
|
|||||||
| unique
|
| unique
|
||||||
| list
|
| list
|
||||||
}}
|
}}
|
||||||
changed_when: false
|
block:
|
||||||
run_once: false
|
- name: Ensure destination directories exist
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
loop: "{{ dest_dirs }}"
|
||||||
|
|
||||||
tasks:
|
- name: Deploy Jinja2 templates
|
||||||
- name: Ensure destination directories exist (unique set)
|
template:
|
||||||
ansible.builtin.file:
|
src: "{{ item.path }}"
|
||||||
path: "{{ item }}"
|
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path ~ '/' ~ inventory_hostname) | regex_replace('\.j2$', '') }}"
|
||||||
state: directory
|
mode: '0644'
|
||||||
mode: '0755'
|
loop: "{{ host_files }}"
|
||||||
loop: "{{ dest_dirs }}"
|
when: item.path.endswith('.j2')
|
||||||
loop_control:
|
|
||||||
label: "{{ item }}"
|
|
||||||
|
|
||||||
- name: Deploy Jinja2 templates (skip unchanged)
|
- name: Deploy static files
|
||||||
ansible.builtin.template:
|
copy:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: >-
|
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path ~ '/' ~ inventory_hostname) }}"
|
||||||
{{ appdata_base_path }}/{{ item.path
|
mode: '0644'
|
||||||
| relpath(template_base_path ~ '/' ~ inventory_hostname)
|
remote_src: false
|
||||||
| regex_replace('\.j2$', '') }}
|
loop: "{{ host_files }}"
|
||||||
mode: '0644'
|
when: not item.path.endswith('.j2')
|
||||||
loop: "{{ host_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 }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.path }}"
|
|
||||||
when: not item.path.endswith('.j2')
|
|
||||||
|
|||||||
Reference in New Issue
Block a user