add kdrive backup

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-10-01 20:19:50 +02:00
parent 626cb79c1b
commit bf51c3d3df
4 changed files with 74 additions and 1 deletions

View file

@ -102,4 +102,48 @@
authorized_key:
user: root
state: present
key: "{{ hostvars[backup_server]['rsnapshot_ssh_key'] | trim }} root@{{ hostvars[backup_server]['ansible_default_ipv4']['address'] }}"
key: "{{ hostvars[backup_server]['rsnapshot_ssh_key'] | trim }} root@{{ hostvars[backup_server]['ansible_default_ipv4']['address'] }}"
# The kDrive backup stuff
# XXX the credentials must be stored in /etc/davfs2/secrets
- hosts: backup_server
gather_facts: no
tags: kdrive
tasks:
- name: install necessary packages
ansible.builtin.apt:
name:
- davfs2
state: present
update_cache: yes
- name: Copy kdrive mount file
ansible.builtin.copy:
src: files/kdrive.mount
dest: /etc/systemd/system/mnt-kdrive.mount
owner: root
group: root
mode: 0644
register: kdrive_mount
- name: Copy kdrive automount file
ansible.builtin.copy:
src: files/kdrive.automount
dest: /etc/systemd/system/mnt-kdrive.automount
owner: root
group: root
mode: 0644
register: kdrive_automount
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: yes
when: kdrive_mount.changed or kdrive_automount.changed
- name: start automount
ansible.builtin.systemd:
name: mnt-kdrive.automount
state: started
enabled: yes
when: kdrive_automount.changed

View file

@ -0,0 +1,11 @@
[Unit]
Description=Mount kDrive automount
After=network-online.target
Wants=network-online.target
[Automount]
Where=/mnt/kdrive
TimeoutIdleSec=300
[Install]
WantedBy=remote-fs.target

View file

@ -0,0 +1,14 @@
[Unit]
Description=Mount kDrive WebDAV
After=network-online.target
Wants=network-online.target
[Mount]
What=https://371969.connect.kdrive.infomaniak.com
Where=/mnt/kdrive
Options=noauto,user,
Type=davfs
TimeoutSec=60
[Install]
WantedBy=remote-fs.target

View file

@ -229,6 +229,10 @@ backup root@{{host}}:{{ backup_dir }} {{host}}
{% endfor %}
{% endfor %}
### kDrive
backup /mnt/kdrive/ kdrive/
# LOCALHOST
#backup /home/ localhost/
#backup /etc/ localhost/