2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2019-01-19 13:56:23 +00:00
|
|
|
---
|
2018-06-24 13:16:56 +00:00
|
|
|
- name: setup external services network
|
|
|
|
docker_network:
|
|
|
|
name: external_services
|
2018-06-24 13:17:35 +00:00
|
|
|
|
2023-10-03 19:19:51 +00:00
|
|
|
- name: Service block
|
|
|
|
loop: "{{ services | dict2items(key_name='name', value_name='vars') }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: service
|
|
|
|
when: single_service is not defined and
|
|
|
|
(service.vars.disabled_in_vagrant is not defined or
|
|
|
|
not (service.vars.disabled_in_vagrant and vagrant))
|
|
|
|
block:
|
|
|
|
- name: Create volume folder
|
|
|
|
file:
|
|
|
|
name: "{{ service.vars.volume_folder }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Upload Compose file
|
|
|
|
template:
|
|
|
|
src: compose-files/{{ service.name }}.yml.j2
|
|
|
|
dest: "{{ service.vars.volume_folder }}/docker-compose.yml"
|
|
|
|
|
|
|
|
- name: Run pre-deployment tasks
|
|
|
|
include_tasks: pre_deploy/{{ service.name }}.yml
|
|
|
|
when: service.vars.pre_deploy_tasks is defined and service.pre_deploy_tasks
|
|
|
|
|
|
|
|
- name: Deploy Compose stack
|
|
|
|
command: docker compose up -d --remove-orphans --pull always
|
|
|
|
args:
|
|
|
|
chdir: "{{ service.vars.volume_folder }}"
|
|
|
|
|
|
|
|
- name: Run post-deployment tasks
|
|
|
|
include_tasks: post_deploy/{{ service.name }}.yml
|
|
|
|
when: service.vars.post_deploy_tasks is defined and service.post_deploy_tasks
|
|
|
|
|
2018-06-24 16:19:56 +00:00
|
|
|
- name: setup services
|
2022-11-26 21:13:51 +00:00
|
|
|
include_tasks: "services/{{ item.service.file }}"
|
|
|
|
loop: "{{ services | dict2items(value_name='service') }}"
|
2022-11-26 08:15:18 +00:00
|
|
|
when: single_service is not defined and
|
2022-11-26 21:13:51 +00:00
|
|
|
item.service.file is defined and
|
2023-03-05 22:10:53 +00:00
|
|
|
(item.service.disabled_in_vagrant is not defined or
|
|
|
|
not (item.service.disabled_in_vagrant and vagrant))
|
2022-11-26 08:15:18 +00:00
|
|
|
|
|
|
|
- name: setup single service
|
|
|
|
include_tasks: "services/{{ services[single_service].file }}"
|
|
|
|
when: single_service is defined and
|
|
|
|
single_service in services and
|
|
|
|
services[single_service].file is defined and
|
2023-03-05 22:10:53 +00:00
|
|
|
(services[single_service].disabled_in_vagrant is not defined or
|
|
|
|
not (services[single_service].disabled_in_vagrant and vagrant))
|