- name: "Try to update restic" command: "restic self-update" register: restic_update ignore_errors: true - name: "Download restic" get_url: url: "{{ restic_url }}" dest: /tmp/restic.bz2 register: restic_download when: restic_update is failed - name: "Extract restic" command: "bzip2 -df /tmp/restic.bz2" register: restic_extract when: restic_download is changed - name: "Install restic" copy: src: "/tmp/restic" dest: "/usr/bin/restic" remote_src: yes mode: "751" when: restic_extract is changed - name: "Copy the backup script" template: src: "backup-to-restic.j2" dest: "/home/ansible/backup-to-restic" directory_mode: yes owner: "ansible" group: "ansible" mode: 0755 - name: "Create the restic config dir" file: path: "/etc/restic/" state: directory mode: "0755" - name: "Copy excludes file" copy: src: "excludes.txt" dest: "/etc/restic/excludes.txt"