2024-10-11 18:41:46 +02:00
|
|
|
---
|
2024-10-20 22:23:13 +02:00
|
|
|
- name: Create dir for {{ docker_app_name }}
|
2024-10-11 18:41:46 +02:00
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ docker_dir }}"
|
|
|
|
state: directory
|
|
|
|
mode: "0775"
|
2024-11-06 16:31:28 +01:00
|
|
|
when: docker_create_dir
|
2024-10-20 22:23:13 +02:00
|
|
|
- name: Write files for {{ docker_app_name }}
|
2024-10-11 18:41:46 +02:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ docker_dir }}/"
|
2024-10-14 20:12:39 +02:00
|
|
|
mode: preserve
|
2024-10-11 18:41:46 +02:00
|
|
|
with_fileglob:
|
|
|
|
- files/{{ docker_app_name }}/*
|
|
|
|
- files/{{ docker_app_name }}/.*
|
2024-10-23 22:26:26 +02:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item | basename }}"
|
2024-10-11 18:41:46 +02:00
|
|
|
notify:
|
|
|
|
- Restart service
|
2024-11-06 16:31:28 +01:00
|
|
|
when: docker_write_files
|
2024-10-20 22:23:13 +02:00
|
|
|
- name: Write templates for {{ docker_app_name }}
|
2024-10-11 18:41:46 +02:00
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ docker_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
|
2024-10-14 20:12:39 +02:00
|
|
|
mode: preserve
|
2024-10-11 18:41:46 +02:00
|
|
|
with_fileglob:
|
|
|
|
- templates/{{ docker_app_name }}/*.j2
|
|
|
|
- templates/{{ docker_app_name }}/.*.j2
|
2024-10-23 22:26:26 +02:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item | basename }}"
|
2024-10-11 18:41:46 +02:00
|
|
|
notify:
|
|
|
|
- Restart service
|
2024-11-06 16:31:28 +01:00
|
|
|
when: docker_write_files
|
2024-10-23 22:26:26 +02:00
|
|
|
- name: Flush handlers
|
2024-10-11 19:32:39 +02:00
|
|
|
ansible.builtin.meta: flush_handlers
|
2024-10-20 22:23:13 +02:00
|
|
|
- name: Ensure service is started {{ docker_app_name }}
|
2024-10-11 18:41:46 +02:00
|
|
|
community.docker.docker_compose_v2:
|
|
|
|
project_src: "{{ docker_dir }}"
|
|
|
|
state: present
|
2024-10-17 16:52:38 +02:00
|
|
|
remove_orphans: "{{ docker_remove_orphans }}"
|
2024-11-06 16:31:28 +01:00
|
|
|
when: docker_start_service
|