...
Gitea Branch PR & Ansible Deployment / Check and Create PR (push) Successful in 18s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m15s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m23s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m22s
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 18s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (benedikta) (push) Failing after 1m15s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rikku) (push) Failing after 1m23s
Gitea Branch PR & Ansible Deployment / Ansible Dry Run (rinoa) (push) Failing after 1m22s
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,8 +10,8 @@
|
|||||||
template_base_path: "{{ playbook_dir }}/../app-configs"
|
template_base_path: "{{ playbook_dir }}/../app-configs"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Gather files for all hosts (on localhost)
|
- name: Gather all files for each host (on localhost)
|
||||||
find:
|
ansible.builtin.find:
|
||||||
paths: "{{ template_base_path }}/{{ item }}"
|
paths: "{{ template_base_path }}/{{ item }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
@@ -22,9 +22,15 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Deploy files to each host
|
- name: Deploy files for this host
|
||||||
vars:
|
vars:
|
||||||
host_files: "{{ files_per_host.results | selectattr('item','equalto',inventory_hostname) | map(attribute='files') | first }}"
|
host_files: >-
|
||||||
|
{{
|
||||||
|
files_per_host.results
|
||||||
|
| selectattr('item','equalto',inventory_hostname)
|
||||||
|
| map(attribute='files')
|
||||||
|
| first
|
||||||
|
}}
|
||||||
dest_dirs: >-
|
dest_dirs: >-
|
||||||
{{
|
{{
|
||||||
host_files
|
host_files
|
||||||
@@ -37,25 +43,34 @@
|
|||||||
}}
|
}}
|
||||||
block:
|
block:
|
||||||
- name: Ensure destination directories exist
|
- name: Ensure destination directories exist
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
loop: "{{ dest_dirs }}"
|
loop: "{{ dest_dirs }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item }}"
|
||||||
|
|
||||||
- name: Deploy Jinja2 templates
|
- name: Deploy Jinja2 templates
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path ~ '/' ~ inventory_hostname) | regex_replace('\.j2$', '') }}"
|
dest: >-
|
||||||
|
{{ appdata_base_path }}/{{ item.path
|
||||||
|
| relpath(template_base_path ~ '/' ~ inventory_hostname)
|
||||||
|
| regex_replace('\.j2$', '') }}
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
loop: "{{ host_files }}"
|
loop: "{{ host_files }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
when: item.path.endswith('.j2')
|
when: item.path.endswith('.j2')
|
||||||
|
|
||||||
- name: Deploy static files
|
- name: Deploy static files
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path ~ '/' ~ inventory_hostname) }}"
|
dest: "{{ appdata_base_path }}/{{ item.path | relpath(template_base_path ~ '/' ~ inventory_hostname) }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
remote_src: false
|
remote_src: false
|
||||||
loop: "{{ host_files }}"
|
loop: "{{ host_files }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
when: not item.path.endswith('.j2')
|
when: not item.path.endswith('.j2')
|
||||||
|
|||||||
Reference in New Issue
Block a user