Replace clonedrive with two systemd items
This commit is contained in:
parent
0e8bacb90c
commit
6231c7937a
|
@ -1,15 +0,0 @@
|
|||
[Unit]
|
||||
Description=Clonedrive service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
User=media
|
||||
Group=media
|
||||
ExecStart=/srv/app/clonedrive/clonedrive.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,6 +1,7 @@
|
|||
[Unit]
|
||||
Description=cloudplow
|
||||
After=network-online.target
|
||||
After=mnt-media.mount
|
||||
Requires=mnt-media.mount
|
||||
|
||||
[Service]
|
||||
User=media
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"core": {
|
||||
"dry_run": false,
|
||||
"rclone_binary_path": "/usr/bin/rclone",
|
||||
"rclone_config_path": "/srv/etc/rclone.conf"
|
||||
"rclone_config_path": "/srv/etc/rclone/rclone.conf"
|
||||
},
|
||||
"hidden": {
|
||||
"/mnt/.media.cache/.unionfs": {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
- name: "Media Server: Group"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
- cloudplow
|
||||
group:
|
||||
name: "media"
|
||||
|
@ -14,7 +13,6 @@
|
|||
- name: "Media Server: User"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
- cloudplow
|
||||
user:
|
||||
name: "media"
|
||||
|
@ -23,22 +21,6 @@
|
|||
expires: -1
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Mountpoints"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "media"
|
||||
group: "media"
|
||||
loop:
|
||||
- "/mnt/media"
|
||||
- "/mnt/GoogleDriveCrypt"
|
||||
- "/mnt/.media.cache"
|
||||
- "/mnt/.overlay.work"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Cloudplow: git repo"
|
||||
tags:
|
||||
- install
|
||||
|
@ -61,27 +43,6 @@
|
|||
recurse: yes
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Clonedrive: git repo"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
git:
|
||||
repo: "https://github.com/scottwallacesh/clonedrive.git"
|
||||
dest: "/srv/app/clonedrive"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Clonedrive: directory"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
file:
|
||||
path: "/srv/app/clonedrive"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "media"
|
||||
group: "media"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Cloudplow: config"
|
||||
tags:
|
||||
- config
|
||||
|
@ -94,37 +55,6 @@
|
|||
group: "media"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Configuration: sudoers"
|
||||
tags:
|
||||
- config
|
||||
- clonedrive
|
||||
copy:
|
||||
dest: "/etc/sudoers.d/media_clonedrive"
|
||||
content: "media ALL = NOPASSWD: /usr/bin/mount,/usr/bin/umount\n"
|
||||
mode: "0440"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Clonedrive: service config"
|
||||
tags:
|
||||
- install
|
||||
- clonedrive
|
||||
copy:
|
||||
dest: "/etc/systemd/system/clonedrive.service"
|
||||
src: "files/clonedrive.service"
|
||||
mode: "0644"
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Clonedrive: service"
|
||||
tags:
|
||||
- config
|
||||
- clonedrive
|
||||
systemd:
|
||||
name: "clonedrive"
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
become: yes
|
||||
|
||||
- name: "Media Server: Cloudplow: Python dependencies"
|
||||
tags:
|
||||
- install
|
||||
|
|
10
.ansible/roles/rclone_mount/files/mnt-media.mount
Normal file
10
.ansible/roles/rclone_mount/files/mnt-media.mount
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Before=local-fs.target
|
||||
After=rclone.service
|
||||
Requires=rclone.service
|
||||
|
||||
[Mount]
|
||||
Where=/mnt/media
|
||||
What=overlay
|
||||
Type=overlay
|
||||
Options=rw,relatime,lowerdir=/mnt/GoogleDriveCrypt,upperdir=/mnt/.media.cache,workdir=/mnt/.overlay.work
|
29
.ansible/roles/rclone_mount/files/rclone.service
Normal file
29
.ansible/roles/rclone_mount/files/rclone.service
Normal file
|
@ -0,0 +1,29 @@
|
|||
[Unit]
|
||||
Description=Google Drive (rclone)
|
||||
AssertPathIsDirectory=/mnt/GoogleDriveCrypt
|
||||
Requires=systemd-networkd.service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
Before=mnt-media.mount
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/rclone mount \
|
||||
--config=/srv/etc/rclone/rclone.conf \
|
||||
--allow-other \
|
||||
--no-modtime \
|
||||
--read-only \
|
||||
--dir-cache-time=240m \
|
||||
--tpslimit=10 \
|
||||
--tpslimit-burst=1 \
|
||||
--buffer-size=1G \
|
||||
GoogleDriveCrypt:/ /mnt/GoogleDriveCrypt
|
||||
ExecStartPost=/bin/bash -c 'while [ ! -d /mnt/GoogleDriveCrypt/_Other ]; do /usr/bin/sleep 5; done'
|
||||
ExecStop=/bin/fusermount -u /mnt/GoogleDriveCrypt
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
User=media
|
||||
Group=media
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -3,6 +3,21 @@
|
|||
tags:
|
||||
- rclone
|
||||
block:
|
||||
- name: "Rclone: Mountpoints"
|
||||
tags:
|
||||
- install
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "media"
|
||||
group: "media"
|
||||
loop:
|
||||
- "/mnt/media"
|
||||
- "/mnt/GoogleDriveCrypt"
|
||||
- "/mnt/.media.cache"
|
||||
- "/mnt/.overlay.work"
|
||||
become: yes
|
||||
|
||||
- name: "Rclone: Packages"
|
||||
tags:
|
||||
- install
|
||||
|
@ -31,3 +46,42 @@
|
|||
regexp: "^#?user_allow_other"
|
||||
line: "user_allow_other"
|
||||
become: yes
|
||||
|
||||
- name: "Rclone: Install: rclone service"
|
||||
tags:
|
||||
- install
|
||||
copy:
|
||||
dest: "/etc/systemd/system/rclone.service"
|
||||
src: "files/rclone.service"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0444"
|
||||
become: yes
|
||||
|
||||
- name: "Rclone: Configure: rclone service"
|
||||
tags:
|
||||
- config
|
||||
systemd:
|
||||
name: rclone
|
||||
enabled: yes
|
||||
state: started
|
||||
become: yes
|
||||
|
||||
- name: "Rclone: Install:/mnt/media mount"
|
||||
tags:
|
||||
- install
|
||||
copy:
|
||||
dest: "/etc/systemd/system/mnt-media.mount"
|
||||
src: "files/mnt-media.mount"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0444"
|
||||
become: yes
|
||||
|
||||
- name: "Rclone: Configure: /mnt/media mount"
|
||||
tags:
|
||||
- config
|
||||
systemd:
|
||||
name: mnt-media.mount
|
||||
state: started
|
||||
become: yes
|
||||
|
|
Loading…
Reference in a new issue