diff --git a/playbooks/roles/forgejo_runner/vars/main.yml b/playbooks/roles/forgejo_runner/vars/main.yml index 38a1937..e567170 100644 --- a/playbooks/roles/forgejo_runner/vars/main.yml +++ b/playbooks/roles/forgejo_runner/vars/main.yml @@ -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: diff --git a/playbooks/stop-and-backup-unused.yml b/playbooks/stop-and-backup-unused.yml index 5b6d3d5..ee71a40 100644 --- a/playbooks/stop-and-backup-unused.yml +++ b/playbooks/stop-and-backup-unused.yml @@ -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 diff --git a/playbooks/tasks/restore-volumes.yml b/playbooks/tasks/restore-volumes.yml index fd7890a..b61358e 100644 --- a/playbooks/tasks/restore-volumes.yml +++ b/playbooks/tasks/restore-volumes.yml @@ -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 diff --git a/playbooks/tasks/steps/restore-volume.yml b/playbooks/tasks/steps/restore-volume.yml index 5574995..e622bbc 100644 --- a/playbooks/tasks/steps/restore-volume.yml +++ b/playbooks/tasks/steps/restore-volume.yml @@ -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