refactor: separate templating for j2 and normal files

This commit is contained in:
Yuri Tatishchev 2024-10-30 18:11:26 -07:00
parent dd0330c85a
commit fc6e485a61
Signed by: CaZzzer
GPG Key ID: 28BE602058C08557
2 changed files with 13 additions and 5 deletions

View File

@ -10,7 +10,7 @@
file:
path: "{{ current_stack_dest }}/{{ item.path }}"
state: directory
mode: "700"
mode: "755"
loop: "{{ lookup('community.general.filetree', current_stack_source) }}"
when: item.state == "directory"
@ -18,9 +18,17 @@
template:
src: "{{ item.src }}"
dest: "{{ current_stack_dest }}/{{ item.path | regex_replace('\\.j2$', '') }}"
mode: "600"
mode: "644"
loop: "{{ lookup('community.general.filetree', current_stack_source) }}"
when: item.state == "file"
when: item.state == "file" and item.path | regex_search('\\.j2$')
- name: Generate {{ current_stack_name }} deployment from static files
copy:
src: "{{ item.src }}"
dest: "{{ current_stack_dest }}/{{ item.path }}"
mode: "644"
loop: "{{ lookup('community.general.filetree', current_stack_source) }}"
when: item.state == "file" and not item.path | regex_search('\\.j2$')
- name: Deploy docker-compose for {{ current_stack_name }}
community.docker.docker_compose_v2:
@ -30,5 +38,5 @@
remove_orphans: yes
register: docker_compose_output
- debug:
var: docker_compose_output
# - debug:
# var: docker_compose_output