2023-10-04 17:35:52 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2024-03-01 20:30:18 +00:00
|
|
|
# code: language=ansible
|
2023-10-04 17:35:52 +00:00
|
|
|
---
|
2024-03-29 21:55:56 +00:00
|
|
|
- name: Create volume folder for service '{{ service.name }}'
|
2023-10-04 17:35:52 +00:00
|
|
|
file:
|
|
|
|
name: "{{ service.vars.volume_folder }}"
|
|
|
|
state: directory
|
|
|
|
|
2024-03-29 21:55:56 +00:00
|
|
|
- name: Upload Compose file for service '{{ service.name }}'
|
2023-10-04 17:35:52 +00:00
|
|
|
template:
|
|
|
|
src: compose-files/{{ service.name }}.yml.j2
|
|
|
|
dest: "{{ service.vars.volume_folder }}/docker-compose.yml"
|
2023-12-07 19:39:04 +00:00
|
|
|
owner: root
|
|
|
|
mode: u=rw,go=
|
2023-10-04 17:35:52 +00:00
|
|
|
|
2024-03-29 21:55:56 +00:00
|
|
|
- name: Run pre-deployment tasks for service '{{ service.name }}'
|
|
|
|
ansible.builtin.include_tasks: pre_deploy/{{ service.name }}.yml
|
2023-10-04 17:35:52 +00:00
|
|
|
when: service.vars.pre_deploy_tasks is defined and service.vars.pre_deploy_tasks
|
|
|
|
|
2024-03-29 21:55:56 +00:00
|
|
|
- name: Deploy service '{{ service.name }}'
|
|
|
|
when: deploy_services is defined and deploy_services
|
|
|
|
block:
|
|
|
|
- name: Deploy Compose stack for service '{{ service.name }}'
|
2024-03-30 18:16:29 +00:00
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: docker compose up -d --remove-orphans
|
2024-03-29 21:55:56 +00:00
|
|
|
chdir: "{{ service.vars.volume_folder }}"
|
2023-10-04 17:35:52 +00:00
|
|
|
|
2024-03-29 21:55:56 +00:00
|
|
|
- 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
|