40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
|
---
|
||
|
- name: Set common facts
|
||
|
ansible.builtin.import_tasks: tasks/set-default-facts.yml
|
||
|
|
||
|
- name: Deploy {{ svc.name }}
|
||
|
vars:
|
||
|
svc: "{{ backup_svc }}"
|
||
|
env: "{{ backup_env }}"
|
||
|
compose: "{{ backup_compose }}"
|
||
|
block:
|
||
|
- name: Import prepare tasks for common service
|
||
|
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
||
|
|
||
|
- name: Copy the main backup script
|
||
|
ansible.builtin.template:
|
||
|
src: "backup.sh.j2"
|
||
|
dest: "{{ (service_path, 'backup.sh') | path_join }}"
|
||
|
mode: "0755"
|
||
|
|
||
|
- name: Import tasks specific to docker
|
||
|
ansible.builtin.import_tasks: docker.yml
|
||
|
- name: Import tasks specific to the backup.d scripts
|
||
|
ansible.builtin.import_tasks: backup.d.yml
|
||
|
- name: Import tasks specific to systemd
|
||
|
ansible.builtin.import_tasks: systemd.yml
|
||
|
|
||
|
- name: Build service
|
||
|
ansible.builtin.command:
|
||
|
cmd: docker compose build --pull
|
||
|
chdir: "{{ service_path }}"
|
||
|
register: cmd_result
|
||
|
when: docker_rebuild
|
||
|
changed_when: true
|
||
|
|
||
|
- name: Verify service
|
||
|
ansible.builtin.command:
|
||
|
cmd: docker compose run --rm app check
|
||
|
chdir: "{{ service_path }}"
|
||
|
changed_when: false
|