From 0ed91a92c69e514776800e22f672f03ea7aef757 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Sat, 6 Jan 2024 02:55:24 +0100 Subject: [PATCH] Move storagebox to cifs share for better performance --- .../host_vars/backup.unruhig.eu/vault.yaml | 7 +++++ ansible/plays/backup.yaml | 31 +++++++------------ .../plays/templates/mount-storagebox.mount.j2 | 6 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 ansible/host_vars/backup.unruhig.eu/vault.yaml diff --git a/ansible/host_vars/backup.unruhig.eu/vault.yaml b/ansible/host_vars/backup.unruhig.eu/vault.yaml new file mode 100644 index 0000000..8381ded --- /dev/null +++ b/ansible/host_vars/backup.unruhig.eu/vault.yaml @@ -0,0 +1,7 @@ +$ANSIBLE_VAULT;1.1;AES256 +64323432633839313739346636383934366264653165373433316239366235613336646462333031 +3633326564323431653131653436386563613562633432390a383161343463343366336266303038 +36316230323264646532386238363331663364353365643861323536643961613561626265313762 +3864373034646433300a623535623532353965333030383065346562393139313437313438623361 +63336531373365383463303437343833646531366363353630626134373932303063653530323433 +6639623264316133356463333236623032356138636361383966 diff --git a/ansible/plays/backup.yaml b/ansible/plays/backup.yaml index 64bb371..4000230 100644 --- a/ansible/plays/backup.yaml +++ b/ansible/plays/backup.yaml @@ -25,44 +25,37 @@ ansible.builtin.file: path: "/home/backup/.config/systemd/user" state: directory - - name: Check if user is lingering - become: true - stat: - path: "/var/lib/systemd/linger/backup" - register: user_lingering - - name: Enable lingering for user if needed - become: true - command: "loginctl enable-linger backup" - when: - - not user_lingering.stat.exists - name: Create mount unit become: true - become_user: backup + become_user: root ansible.builtin.template: src: mount-storagebox.mount.j2 - dest: /home/backup/.config/systemd/user/var-home-backup-storagebox.mount + owner: root + group: root + mode: "0600" # Credentials + dest: /etc/systemd/system/var-home-backup-storagebox.mount - name: Create automount unit become: true - become_user: backup + become_user: root ansible.builtin.template: src: mount-storagebox.automount.j2 - dest: /home/backup/.config/systemd/user/var-home-backup-storagebox.automount + dest: /etc/systemd/system/var-home-backup-storagebox.automount + owner: root + group: root + mode: "0644" - name: Start storagebox Mount Service become: true - become_user: backup + become_user: root ansible.builtin.systemd: name: var-home-backup-storagebox.mount state: started enabled: true daemon_reload: true - scope: user - name: enable storagebox automount Mount Unit become: true - become_user: backup + become_user: root ansible.builtin.systemd: name: var-home-backup-storagebox.automount enabled: true - scope: user - # vim: ft=yaml.ansible diff --git a/ansible/plays/templates/mount-storagebox.mount.j2 b/ansible/plays/templates/mount-storagebox.mount.j2 index c743e4e..accdbb2 100644 --- a/ansible/plays/templates/mount-storagebox.mount.j2 +++ b/ansible/plays/templates/mount-storagebox.mount.j2 @@ -7,8 +7,8 @@ Wants=network-online.target WantedBy=default.target [Mount] -What=u309229-sub6@u309229.your-storagebox.de: +What=//u309229-sub6.your-storagebox.de/u309229-sub6 Where=/var/home/backup/storagebox -Type=fuse.sshfs -Options=_netdev,reconnect,uid=1000,gid=1000,delay_connect,ServerAliveInterval=30,ServerAliveCountMax=5,x-systemd.automount,Port=23,IdentityFile=/var/home/backup/.ssh/storagebox +Type=cifs +Options=_netdev,iocharset=utf8,username=u309229-sub6,password={{ cifs.password }},uid=1000,gid=1000,x-systemd.automount TimeoutSec=60