ansible/roles/docker/tasks/main.yaml

34 lines
1 KiB
YAML
Raw Normal View History

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-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 }}/.*
notify:
- Restart service
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
notify:
- Restart service
2024-10-20 22:23:13 +02:00
- name: Flush handlers for {{ docker_app_name }}
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 }}"