infrastructure/playbooks/roles/backup/tasks/main.yml
Tobias Reisinger 4104057771
Fix pre-commit hooks and move directories
roles/ and inventory/ are now in playbooks/
also fixed issues reported by ansible-lint
2024-10-14 18:31:36 +02:00

46 lines
1.3 KiB
YAML

---
- name: Set common facts
ansible.builtin.import_tasks: tasks/set-default-facts.yml
- name: Deploy {{ role_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