summaryrefslogtreecommitdiffstats
path: root/roles/restic/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/restic/tasks/main.yml')
-rw-r--r--roles/restic/tasks/main.yml20
1 files changed, 20 insertions, 0 deletions
diff --git a/roles/restic/tasks/main.yml b/roles/restic/tasks/main.yml
index ae82d3bc..8640a521 100644
--- a/roles/restic/tasks/main.yml
+++ b/roles/restic/tasks/main.yml
@@ -10,3 +10,23 @@
cmd: "mise use --global restic@{{ restic_version }}"
changed_when: true
when: restic_version not in restic_installed_versions.stdout
+
+# mise installs restic under whichever user ran this task's own home. When
+# that's root (e.g. containers connected to as root), the binary ends up
+# under /root, unreachable by other accounts (ex. backup user)
+# This copies the binary to a system-wide location so that any user can use it.
+- name: "Resolve installed restic path"
+ ansible.builtin.command:
+ cmd: "mise which restic"
+ register: restic_bin_path
+ changed_when: false
+
+- name: "Expose restic system-wide"
+ become: true
+ ansible.builtin.copy:
+ remote_src: true
+ src: "{{ restic_bin_path.stdout }}"
+ dest: "/usr/local/bin/restic"
+ mode: "0755"
+ owner: "root"
+ group: "root"