summaryrefslogtreecommitdiffstats
path: root/roles/restic
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-21 12:41:07 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-21 12:46:53 +0200
commit0be7583911bfe15276b736697caebb3752da56b6 (patch)
tree869bbd8b270f22c6c02460b20d3146dcc04e5be3 /roles/restic
parent34157b435c2103ecb87c26c1368c6ccf7b3d6410 (diff)
Fix restic install and add backup role
Co-Authored-By: Claude.ai
Diffstat (limited to 'roles/restic')
-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"