Modifying Playbook to adhere to dir structure.
This commit is contained in:
@@ -5,16 +5,23 @@
|
||||
appdata_base_path: "~/.docker/config/appdata"
|
||||
|
||||
tasks:
|
||||
- name: Recursively collect all Jinja2 templates (*.j2)
|
||||
ansible.builtin.find:
|
||||
paths: "app-configs"
|
||||
patterns: "*.j2"
|
||||
recurse: true
|
||||
register: template_files
|
||||
|
||||
- name: Ensure target directories exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ appdata_base_path }}/{{ (item | basename | regex_replace('\\.j2$', '') | regex_replace('_', '/') | regex_replace('/[^/]+$', '')) }}"
|
||||
path: "{{ appdata_base_path }}/{{ item.path | regex_replace('^app-configs/', '') | regex_replace('\\.j2$', '') | dirname }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
loop: "{{ query('fileglob', 'app-configs/*.j2') }}"
|
||||
loop: "{{ template_files.files }}"
|
||||
|
||||
- name: Deploy configuration templates
|
||||
- name: Deploy rendered templates
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ appdata_base_path }}/{{ item | basename | regex_replace('\\.j2$', '') | regex_replace('_', '/') }}"
|
||||
src: "{{ item.path }}"
|
||||
dest: "{{ appdata_base_path }}/{{ item.path | regex_replace('^app-configs/', '') | regex_replace('\\.j2$', '') }}"
|
||||
mode: '0644'
|
||||
loop: "{{ query('fileglob', 'app-configs/*.j2') }}"
|
||||
loop: "{{ template_files.files }}"
|
||||
|
||||
Reference in New Issue
Block a user