--- - name: Copy archives ansible.builtin.copy: src: "{{ item.src }}" dest: "{{ item.dest }}" loop: - { src: '{{ restore.cloud.nextcloud_archive }}', dest: 'cloud_nextcloud.tar.gz' } - { src: '{{ restore.cloud.db_archive }}', dest: 'cloud_db.tar.gz' } - name: Stop nextcloud container community.docker.docker_compose: project_src: cloud state: absent become: true - name: Restore backup community.docker.docker_container: name: volume_restore image: volume_restore:latest auto_remove: yes tty: true volumes: - "{{ item.path }}:/backup/archive.tar.gz" - "{{ item.volume }}:/backup/dest" loop: - { path: './cloud_nextcloud.tar.gz', volume: 'cloud_nextcloud' } - { path: './cloud_db.tar.gz', volume: 'cloud_db' } become: true - name: Start nextcloud container community.docker.docker_compose: project_src: cloud state: present become: true - name: Remove archive ansible.builtin.file: path: "{{ item.path }}" state: absent loop: - { path: 'cloud_nextcloud.tar.gz' } - { path: 'cloud_db.tar.gz' }