Refactor service deployment + upload Compose files to the server #178

Merged
samsapti merged 24 commits from compose-files into main 2023-12-09 18:38:11 +00:00
Showing only changes of commit 98fcc2d634 - Show all commits

View file

@ -1,24 +1,24 @@
# vim: ft=yaml.ansible # vim: ft=yaml.ansible
--- ---
- name: Create volume folder - name: Create volume folder for service {{ service.name }}
file: file:
name: "{{ service.vars.volume_folder }}" name: "{{ service.vars.volume_folder }}"
state: directory state: directory
- name: Upload Compose file - name: Upload Compose file for service {{ service.name }}
template: template:
src: compose-files/{{ service.name }}.yml.j2 src: compose-files/{{ service.name }}.yml.j2
dest: "{{ service.vars.volume_folder }}/docker-compose.yml" dest: "{{ service.vars.volume_folder }}/docker-compose.yml"
- name: Run pre-deployment tasks - name: Run pre-deployment tasks for service {{ service.name }}
include_tasks: pre_deploy/{{ service.name }}.yml include_tasks: pre_deploy/{{ service.name }}.yml
when: service.vars.pre_deploy_tasks is defined and service.vars.pre_deploy_tasks when: service.vars.pre_deploy_tasks is defined and service.vars.pre_deploy_tasks
- name: Deploy Compose stack - name: Deploy Compose stack for service {{ service.name }}
command: docker compose up -d --remove-orphans --pull always command: docker compose up -d --remove-orphans --pull always
args: args:
chdir: "{{ service.vars.volume_folder }}" chdir: "{{ service.vars.volume_folder }}"
- name: Run post-deployment tasks - name: Run post-deployment tasks for service {{ service.name }}
include_tasks: post_deploy/{{ service.name }}.yml include_tasks: post_deploy/{{ service.name }}.yml
when: service.vars.post_deploy_tasks is defined and service.vars.post_deploy_tasks when: service.vars.post_deploy_tasks is defined and service.vars.post_deploy_tasks