31 lines
1.1 KiB
YAML
31 lines
1.1 KiB
YAML
# vim: ft=yaml.ansible
|
|
# code: language=ansible
|
|
---
|
|
- name: Create volume folder for service '{{ service.name }}'
|
|
file:
|
|
name: "{{ service.vars.volume_folder }}"
|
|
state: directory
|
|
|
|
- name: Upload Compose file for service '{{ service.name }}'
|
|
template:
|
|
src: compose-files/{{ service.name }}.yml.j2
|
|
dest: "{{ service.vars.volume_folder }}/docker-compose.yml"
|
|
owner: root
|
|
mode: u=rw,go=
|
|
|
|
- name: Run pre-deployment tasks for service '{{ service.name }}'
|
|
ansible.builtin.include_tasks: pre_deploy/{{ service.name }}.yml
|
|
when: service.vars.pre_deploy_tasks is defined and service.vars.pre_deploy_tasks
|
|
|
|
- name: Deploy service '{{ service.name }}'
|
|
when: deploy_services is defined and deploy_services
|
|
block:
|
|
- name: Deploy Compose stack for service '{{ service.name }}'
|
|
ansible.builtin.command:
|
|
cmd: docker compose up -d --remove-orphans
|
|
chdir: "{{ service.vars.volume_folder }}"
|
|
|
|
- name: Run post-deployment tasks for service '{{ service.name }}'
|
|
ansible.builtin.include_tasks: post_deploy/{{ service.name }}.yml
|
|
when: service.vars.post_deploy_tasks is defined and service.vars.post_deploy_tasks
|