43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
# https://stackoverflow.com/questions/41667864/can-the-templates-module-handle-multiple-templates-directories
|
|
|
|
- name: Ensure service directory exists
|
|
file:
|
|
path: "{{ current_svc_path }}"
|
|
state: directory
|
|
mode: "500"
|
|
|
|
- name: Ensure directory structure exists
|
|
file:
|
|
path: "{{ current_svc_path }}/{{ item.path }}"
|
|
state: directory
|
|
mode: "500"
|
|
with_community.general.filetree: "{{ templates_source }}"
|
|
when: item.state == "directory"
|
|
|
|
|
|
- name: Include app config variables
|
|
include_vars:
|
|
file: "{{ role_path }}/vars/app_config.yml"
|
|
|
|
- name: Generate {{ current_svc_name }} deployment from templates
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ current_svc_path }}/{{ item.path | regex_replace('\\.j2$', '') }}"
|
|
mode: "400"
|
|
with_community.general.filetree: "{{ templates_source }}"
|
|
when: item.state == "file"
|
|
|
|
- name: Prepare ZFS datasets for volumes of {{ current_svc_name }}
|
|
vars:
|
|
full_volume_name: "{{ current_svc_name }}_{{ item }}"
|
|
include_tasks: "{{ playbook_dir }}/contrib/docker_volume_prepare_zfs.yml"
|
|
loop: "{{ docker_volume_names }}"
|
|
when: docker_volume_names is defined
|
|
|
|
- name: Deploy docker-compose for {{ current_svc_name }}
|
|
community.docker.docker_compose:
|
|
project_src: "{{ current_svc_path }}"
|
|
state: present
|
|
pull: true
|
|
remove_orphans: true
|