You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/_deploy/tasks/configs.yml

59 lines
1.8 KiB
YAML

---
- name: 'Ensures {{ current_base_path }}/{{ current_destination }} directory exists'
file:
state: directory
path: '{{ current_base_path }}/{{ current_destination }}'
tags:
- update_deployment
- update_config
- name: 'Ensure directory structure for {{ current_config }} exists'
file:
path: "{{ current_base_path }}/{{ current_destination }}/{{ item.path }}"
state: directory
owner: "{{ current_owner }}"
group: "{{ current_group }}"
mode: 0755
with_filetree: "templates/{{ current_config }}"
when: item.state == "directory"
tags:
- update_config
- name: Ensure docker files are populated from templates
template:
src: "{{ item.src }}"
dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path | regex_replace('\\.j2$', '') }}"
owner: "{{ current_owner }}"
group: "{{ current_group }}"
mode: 0644
with_filetree: "templates/_docker"
when: item.state == 'file' and item.src is match('.*\.j2$')
tags:
- update_deployment
- update_config
- name: Ensure config template files are populated from templates
template:
src: "{{ item.src }}"
dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path | regex_replace('\\.j2$', '') }}"
owner: "{{ current_owner }}"
group: "{{ current_group }}"
mode: 0644
with_filetree: "templates/{{ current_config }}"
when: item.state == 'file' and item.src is match('.*\.j2$')
tags:
- update_config
- name: Ensure config files are populated from templates
copy:
src: "{{ item.src }}"
dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path }}"
owner: "{{ current_owner }}"
group: "{{ current_group }}"
mode: 0644
with_filetree: "templates/{{ current_config }}"
when: item.state == 'file' and item.src is not match('.*\.j2$')
tags:
- update_config