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/templates.yml

68 lines
2.0 KiB
YAML

---
### tags:
### update_certs
### update_config
### update_deployment
- name: 'Delete {{ current_base_path }}/{{ current_destination }}'
file:
state: absent
path: "{{ current_base_path }}/{{ current_destination }}"
when: cleanup_destination is defined and cleanup_destination == "true"
tags:
- update_certs
- update_config
- update_deployment
- name: 'Ensures {{ current_base_path }}/{{ current_destination }} directory exists'
file:
state: directory
path: '{{ current_base_path }}/{{ current_destination }}'
tags:
- update_certs
- update_config
- update_deployment
- 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_certs
- update_config
- update_deployment
- name: Ensure config template files are populated from templates/{{ current_config }}
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_certs
- update_config
- update_deployment
- name: Ensure config files are populated from from templates/{{ current_config }}
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_certs
- update_config
- update_deployment