Files
rinoa-docker/ansible/docker_config_deploy.yml
T

32 lines
1.1 KiB
YAML

---
- name: Deploy Docker Service Configurations
hosts: rinoa
vars:
template_base_path: "{{ playbook_dir }}/app-configs"
appdata_base_path: "~/.docker/config/appdata"
tasks:
- name: Find all Jinja2 templates
ansible.builtin.find:
paths: "{{ template_base_path }}"
patterns: "*.j2"
recurse: yes
register: jinja_templates
- name: Ensure target directories exist
ansible.builtin.file:
path: "{{ appdata_base_path }}/{{ item.path | regex_replace('^' + template_base_path + '/', '') | regex_replace('\\.j2$', '') | dirname }}"
state: directory
mode: '0755'
loop: "{{ jinja_templates.files }}"
loop_control:
label: "{{ item.path }}"
- name: Render and deploy templates
ansible.builtin.template:
src: "{{ item.path }}"
dest: "{{ appdata_base_path }}/{{ item.path | regex_replace('^' + template_base_path + '/', '') | regex_replace('\\.j2$', '') }}"
mode: '0644'
loop: "{{ jinja_templates.files }}"
loop_control:
label: "{{ item.path }}"