Replace backup script with autorestic
This commit is contained in:
parent
13084e3558
commit
ed51a86935
17 changed files with 188 additions and 232 deletions
|
|
@ -4,36 +4,31 @@
|
|||
|
||||
- name: Deploy {{ svc.name }}
|
||||
vars:
|
||||
svc: "{{ backup_svc }}"
|
||||
env: "{{ backup_env }}"
|
||||
compose: "{{ backup_compose }}"
|
||||
yml: "{{ backup_yml }}"
|
||||
block:
|
||||
- name: Import prepare tasks for common service
|
||||
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
||||
|
||||
- name: Copy the main backup script
|
||||
- name: Template the main backup script
|
||||
ansible.builtin.template:
|
||||
src: "backup.sh.j2"
|
||||
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: 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
|
||||
- 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
|
||||
cmd: autorestic -v check
|
||||
chdir: "{{ service_path }}"
|
||||
changed_when: false
|
||||
become: true
|
||||
|
|
|
|||
Loading…
Reference in a new issue