2024-09-26 22:02:36 +00:00
|
|
|
---
|
|
|
|
- name: Set common facts
|
|
|
|
ansible.builtin.import_tasks: tasks/set-default-facts.yml
|
|
|
|
|
|
|
|
- name: Deploy {{ svc.name }}
|
|
|
|
vars:
|
2024-10-05 23:59:46 +00:00
|
|
|
yml: "{{ backup_yml }}"
|
2024-09-26 22:02:36 +00:00
|
|
|
block:
|
|
|
|
- name: Import prepare tasks for common service
|
|
|
|
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
|
|
|
|
2024-10-05 23:59:46 +00:00
|
|
|
- name: Template the main backup script
|
2024-09-26 22:02:36 +00:00
|
|
|
ansible.builtin.template:
|
2024-10-05 23:59:46 +00:00
|
|
|
src: backup.sh.j2
|
2024-09-26 22:02:36 +00:00
|
|
|
dest: "{{ (service_path, 'backup.sh') | path_join }}"
|
|
|
|
mode: "0755"
|
|
|
|
|
2024-10-05 23:59:46 +00:00
|
|
|
- name: Template autorestic.yml
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: yml.j2
|
|
|
|
dest: "{{ (service_path, '.autorestic.yml') | path_join }}"
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
- name: Import tasks specific to the hooks scripts
|
|
|
|
ansible.builtin.import_tasks: hooks.yml
|
2024-09-26 22:02:36 +00:00
|
|
|
- name: Import tasks specific to systemd
|
|
|
|
ansible.builtin.import_tasks: systemd.yml
|
|
|
|
|
|
|
|
- name: Verify service
|
|
|
|
ansible.builtin.command:
|
2024-10-05 23:59:46 +00:00
|
|
|
cmd: autorestic -v check
|
2024-09-26 22:02:36 +00:00
|
|
|
chdir: "{{ service_path }}"
|
|
|
|
changed_when: false
|
2024-10-05 23:59:46 +00:00
|
|
|
become: true
|