ansible/roles/docker/tasks/main.yaml

34 lines
900 B
YAML
Raw Normal View History

2024-10-11 18:41:46 +02:00
---
- name: Create dir
ansible.builtin.file:
path: "{{ docker_dir }}"
state: directory
mode: "0775"
- name: Write files
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
- name: Write templates
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-11 19:32:39 +02:00
- name: Flush handlers
ansible.builtin.meta: flush_handlers
2024-10-11 18:41:46 +02:00
- name: Ensure service is started
community.docker.docker_compose_v2:
project_src: "{{ docker_dir }}"
state: present
2024-10-17 16:52:38 +02:00
remove_orphans: "{{ docker_remove_orphans }}"