Fix ansible issues

This commit is contained in:
Tobias Reisinger 2024-10-29 00:13:56 +01:00
parent 0bbfe1acec
commit d92de81c56
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 9 additions and 7 deletions

View file

@ -22,6 +22,7 @@ forgejo_runner_compose:
docker-in-docker:
image: docker:dind
privileged: true
restart: always
command: dockerd -H tcp://0.0.0.0:2375 --tls=false
networks:
default:

View file

@ -21,7 +21,7 @@
- name: Backup unused services
ansible.builtin.command:
cmd: sudo autorestic -c .autorestic.all.yml backup -l {{ item }}
cmd: sudo autorestic -c .autorestic.all.yml backup -l {{ item.name }}
chdir: "{{ (services_path, 'backup') | path_join }}"
loop: "{{ unused_services_backups }}"
changed_when: true

View file

@ -1,6 +1,7 @@
- name: Restore volumes
ansible.builtin.include_tasks:
file: tasks/steps/restore-volume.yml
loop: "{{ all_services | service_get_backups(role_name) | map(attribute='name') }}"
loop: "{{ all_services | service_get_backups(role_name) }}"
when: volume.type == 'docker'
loop_control:
loop_var: volume_name
loop_var: volume

View file

@ -1,11 +1,11 @@
- name: Get infos on volume "{{ volume_name }}"
- name: Get infos on volume "{{ volume.name }}"
community.docker.docker_volume_info:
name: "{{ volume_name }}"
name: "{{ volume.name }}"
register: volume_info_result
- name: Restore volume "{{ volume_name }}"
- name: Restore volume "{{ volume.name }}"
ansible.builtin.command:
cmd: sudo autorestic -c .autorestic.all.yml restore -l {{ volume_name }}
cmd: sudo autorestic -c .autorestic.all.yml restore -l {{ volume.name }} --from borgbase
chdir: "{{ (services_path, 'backup') | path_join }}"
when: not volume_info_result.exists
changed_when: true