46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
---
|
|
- name: Set common facts
|
|
ansible.builtin.import_tasks: tasks/set-default-facts.yml
|
|
|
|
- name: Deploy {{ svc.name }}
|
|
vars:
|
|
yml: "{{ backup_yml }}"
|
|
block:
|
|
- name: Import prepare tasks for common service
|
|
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
|
|
|
- name: Template the main backup script
|
|
ansible.builtin.template:
|
|
src: backup.sh.j2
|
|
dest: "{{ (service_path, 'backup.sh') | path_join }}"
|
|
mode: "0755"
|
|
|
|
- name: Template autorestic.yml
|
|
ansible.builtin.template:
|
|
src: yml.j2
|
|
dest: "{{ (service_path, '.autorestic.yml') | path_join }}"
|
|
mode: "0644"
|
|
|
|
- name: Template autorestic.all.yml
|
|
ansible.builtin.template:
|
|
src: yml.j2
|
|
dest: "{{ (service_path, '.autorestic.all.yml') | path_join }}"
|
|
mode: "0644"
|
|
vars:
|
|
yml: "{{ backup_yml_all }}"
|
|
|
|
- name: Import tasks specific to the hooks scripts
|
|
ansible.builtin.import_tasks: hooks.yml
|
|
- name: Import tasks specific to systemd
|
|
ansible.builtin.import_tasks: systemd.yml
|
|
|
|
- name: Verify service
|
|
ansible.builtin.command:
|
|
cmd: autorestic -v check
|
|
chdir: "{{ service_path }}"
|
|
changed_when: false
|
|
become: true
|
|
register: cmd_result_verify
|
|
until: "cmd_result_verify is not failed"
|
|
retries: 10
|
|
delay: 10
|