[python] Add fstab/storagebox

This commit is contained in:
Viyurz 2024-10-07 15:06:44 +02:00
parent 728375f957
commit 8264dfeb38
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
5 changed files with 19 additions and 43 deletions

View file

@ -28,6 +28,18 @@ sudo zerossl-bot certonly --nginx -m viyurz@viyurz.fr -d turn.viyurz.fr
sudo certbot certonly --nginx -d mail.viyurz.fr
```
### Storagebox
Add credential:
```
/etc/storagebox-cifs-credentials.txt
---
username=MYUSERNAME
password=MYPASSWORD
```
Copy & edit file `fstab`.
## Secrets
Copy the existing `secrets.yml.example` to `secrets.yml`, run `ansible-vault encrypt secrets.yml` to encrypt the file with a password, and finally edit the newly encrypted file with `ansible-vault edit secrets.yml`.

4
fstab Normal file
View file

@ -0,0 +1,4 @@
//USERNAME.your-storagebox.de/backup/backups /mnt/storagebox/backups smb3 uid=0,gid=1000,file_mode=0640,dir_mode=0750,credentials=/etc/storagebox-cifs-credentials.txt,iocharset=utf8,rw,mfsymlinks,vers=3,seal 0 0
//USERNAME.your-storagebox.de/backup /mnt/storagebox smb3 uid=0,gid=0,file_mode=0640,dir_mode=0755,credentials=/etc/storagebox-cifs-credentials.txt,iocharset=utf8,rw,mfsymlinks,vers=3,seal 0 0
//USERNAME.your-storagebox.de/backup/syncthing /mnt/storagebox/syncthing smb3 uid=101000,gid=101000,file_mode=0640,dir_mode=0750,credentials=/etc/storagebox-cifs-credentials.txt,iocharset=utf8,rw,mfsymlinks,vers=3,seal 0 0
//USERNAME.your-storagebox.de/backup/fireshare /mnt/storagebox/fireshare smb3 uid=101006,gid=101006,file_mode=0644,dir_mode=0755,credentials=/etc/storagebox-cifs-credentials.txt,iocharset=utf8,rw,mfsymlinks,vers=3,seal 0 0

View file

@ -20,43 +20,7 @@ socket: "/run/podman/podman.sock"
% endif
# cifs_credentials is undefined when we run the backup playbook
# as a cronjob, so set empty default value to prevent errors,
# which is fine because we don't use it.
cifs_host: "{{ cifs_credentials['username'] | default('') }}.your-storagebox.de"
cifs_mounts:
backups:
src: "//{{ cifs_host }}/backup/backups"
path: /mnt/storagebox/backups
uid: 0
gid: "{{ host_uid }}"
file_mode: 640
dir_mode: 750
fireshare:
src: "//{{ cifs_host }}/backup/fireshare"
path: /mnt/storagebox/fireshare
uid: "{{ users['fireshare'] + uid_shift }}"
gid: "{{ users['fireshare'] + uid_shift }}"
file_mode: 644
dir_mode: 755
storagebox:
src: "//{{ cifs_host }}/backup"
path: /mnt/storagebox
uid: 0
gid: 0
file_mode: 640
dir_mode: 751
syncthing:
src: "//{{ cifs_host }}/backup/syncthing"
path: /mnt/storagebox/syncthing
uid: "{{ users['syncthing'] + uid_shift }}"
gid: "{{ users['syncthing'] + uid_shift }}"
file_mode: 640
dir_mode: 750
borg_repodir: "{env['cifs_mounts']['backups']['path']}/borg"
borg_repodir: /mnt/storagebox/backups/borg
borg_passphrase_file: /etc/borg-passphrase.txt

View file

@ -2,10 +2,6 @@
borg:
cifs:
user:
pass:
diun_webhookurl:

View file

@ -15,14 +15,14 @@ declare -a podman_units=(podman.service podman.socket podman-auto-update.service
if [[ "$podman_mode" == "rootless" ]]; then
sudo apt install -y aardvark-dns dbus-user-session nftables passt podman podman-compose python3-mako uidmap
sudo apt install -y aardvark-dns cifs-utils dbus-user-session nftables passt podman podman-compose python3-mako uidmap
sudo loginctl enable-linger "$USER"
sudo systemctl disable --now "${podman_units[@]}"
systemctl --user enable --now "${podman_units[@]}"
else
sudo apt install -y aardvark-dns nftables podman podman-compose python3-mako
sudo apt install -y aardvark-dns cifs-utils nftables podman podman-compose python3-mako
systemctl --user disable --now "${podman_units[@]}"
sudo systemctl enable --now "${podman_units[@]}"