ansible/roles/docker/tasks/main.yaml
Gabriel Augendre 786432d6bd
Some checks failed
/ run ansible (push) Has been cancelled
improve loop verbosity
2024-10-23 22:26:26 +02:00

37 lines
1.1 KiB
YAML

---
- name: Create dir for {{ docker_app_name }}
ansible.builtin.file:
path: "{{ docker_dir }}"
state: directory
mode: "0775"
- name: Write files for {{ docker_app_name }}
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ docker_dir }}/"
mode: preserve
with_fileglob:
- files/{{ docker_app_name }}/*
- files/{{ docker_app_name }}/.*
loop_control:
label: "{{ item | basename }}"
notify:
- Restart service
- name: Write templates for {{ docker_app_name }}
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ docker_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
mode: preserve
with_fileglob:
- templates/{{ docker_app_name }}/*.j2
- templates/{{ docker_app_name }}/.*.j2
loop_control:
label: "{{ item | basename }}"
notify:
- Restart service
- name: Flush handlers
ansible.builtin.meta: flush_handlers
- name: Ensure service is started {{ docker_app_name }}
community.docker.docker_compose_v2:
project_src: "{{ docker_dir }}"
state: present
remove_orphans: "{{ docker_remove_orphans }}"