-
Notifications
You must be signed in to change notification settings - Fork 3
/
onedrive.j2
70 lines (67 loc) · 2.56 KB
/
onedrive.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# /etc/systemd/system/{{ _service_file }}
#########################################################################
# Title: Saltbox: Rclone VFS Mount #
# Author(s): owine, rka #
# URL: https://github.com/saltyorg/Saltbox #
# -- #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
[Unit]
Description=Rclone VFS Mount
After=network-online.target
[Service]
User={{ user.name }}
Group={{ user.name }}
Type=notify
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/rclone mount \
--allow-other \
{% if mounts.ipv4_only %}
--bind={{ ansible_default_ipv4.address }} \
{% endif %}
{% if (rclone_vfs_cache_dir_lookup | length > 0) and item.settings.vfs_cache.enabled %}
--cache-dir={{ rclone_vfs_cache_dir_lookup }} \
{% endif %}
--config={{ rclone_config_path }} \
--buffer-size=250M \
--dir-cache-time={{ rclone_cloud_dir_cache_time }} \
--dropbox-pacer-min-sleep=85ms \
--poll-interval=30s \
--rc \
--rc-no-auth \
--rc-addr=localhost:{{ rclone_remort_port }} \
--syslog \
--timeout=10m \
--umask=002 \
--use-mmap \
--onedrive-no-versions=true \
--onedrive-server-side-across-configs \
--onedrive-chunk-size=250M \
--onedrive-list-chunk=250 \
--user-agent='{{ user_agent }}' \
{% if item.settings.vfs_cache.enabled %} {# As Onedrive does not support streaming, its highly suggested to use caching #}
--vfs-cache-min-free-space={{ rclone_vfs_cache_min_free_space }} \
--vfs-cache-max-age={{ item.settings.vfs_cache.max_age | default('504h') }} \
--vfs-cache-max-size={{ item.settings.vfs_cache.size | default('50G') }} \
--vfs-cache-mode=full \
--vfs-cache-poll-interval={{ rclone_vfs_cache_poll_interval }} \
--vfs-fast-fingerprint \
--vfs-read-ahead=128M \
{% endif %}
--vfs-read-chunk-size-limit=2G \
--vfs-read-chunk-size={{ '32M' if item.settings.vfs_cache.enabled else '250M' }} \
-v \
"{{ rclone_remote_with_path }}" "/mnt/remote/{{ rclone_remote_name }}"
ExecStop=/bin/fusermount3 -uz "/mnt/remote/{{ rclone_remote_name }}"
Restart=on-abort
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
{% if item.settings.vfs_cache.enabled %}
TimeoutSec=21600
LimitNOFILE=infinity
LimitMEMLOCK=infinity
{% endif %}
[Install]
WantedBy=default.target