2024-09-26 22:02:36 +00:00
|
|
|
---
|
|
|
|
- name: Set common facts
|
|
|
|
ansible.builtin.import_tasks: tasks/set-default-facts.yml
|
|
|
|
|
2024-10-13 19:48:04 +00:00
|
|
|
- name: Deploy {{ role_name }}
|
2024-09-26 22:02:36 +00:00
|
|
|
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"
|
|
|
|
|
2024-10-07 22:54:09 +00:00
|
|
|
- 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 }}"
|
|
|
|
|
2024-10-05 23:59:46 +00:00
|
|
|
- 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
|
2024-10-07 19:24:48 +00:00
|
|
|
register: cmd_result_verify
|
|
|
|
until: "cmd_result_verify is not failed"
|
|
|
|
retries: 10
|
|
|
|
delay: 10
|