use docker compose for syncthing
create /apps and /data directory
This commit is contained in:
parent
62f014d90f
commit
a3e4b8d822
5 changed files with 72 additions and 41 deletions
|
@ -2,7 +2,7 @@
|
||||||
git:
|
git:
|
||||||
repo: https://github.com/pizzapim/pizzeria
|
repo: https://github.com/pizzapim/pizzeria
|
||||||
dest: /apps/pizzeria
|
dest: /apps/pizzeria
|
||||||
- name: Start the Docker compose
|
- name: Start the Docker Compose
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose:
|
||||||
project_src: /apps/pizzeria
|
project_src: /apps/pizzeria
|
||||||
pull: true
|
pull: true
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<configuration version="35">
|
<configuration version="37">
|
||||||
<folder id="wdadm-ywcr4" label="sync" path="/home/syncthing/sync" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="n2mbz-tyboq" label="data" path="/data" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
|
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
|
||||||
<encryptionPassword></encryptionPassword>
|
<encryptionPassword></encryptionPassword>
|
||||||
</device>
|
</device>
|
||||||
<device id="SLEOLPB-5CSPOE5-BMH4KCH-F4DMZWR-VFDQ5OP-5YAULXB-TA72A72-KQZJDQK" introducedBy="">
|
|
||||||
<encryptionPassword></encryptionPassword>
|
|
||||||
</device>
|
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning>
|
<versioning>
|
||||||
<cleanupIntervalS>3600</cleanupIntervalS>
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
@ -34,6 +31,14 @@
|
||||||
<copyRangeMethod>standard</copyRangeMethod>
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
<caseSensitiveFS>false</caseSensitiveFS>
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
<junctionsAsDirs>false</junctionsAsDirs>
|
<junctionsAsDirs>false</junctionsAsDirs>
|
||||||
|
<syncOwnership>false</syncOwnership>
|
||||||
|
<sendOwnership>false</sendOwnership>
|
||||||
|
<syncXattrs>false</syncXattrs>
|
||||||
|
<sendXattrs>false</sendXattrs>
|
||||||
|
<xattrFilter>
|
||||||
|
<maxSingleEntrySize>1024</maxSingleEntrySize>
|
||||||
|
<maxTotalSize>4096</maxTotalSize>
|
||||||
|
</xattrFilter>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" name="max" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" name="max" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>dynamic</address>
|
<address>dynamic</address>
|
||||||
|
@ -45,16 +50,6 @@
|
||||||
<untrusted>false</untrusted>
|
<untrusted>false</untrusted>
|
||||||
<remoteGUIPort>0</remoteGUIPort>
|
<remoteGUIPort>0</remoteGUIPort>
|
||||||
</device>
|
</device>
|
||||||
<device id="SLEOLPB-5CSPOE5-BMH4KCH-F4DMZWR-VFDQ5OP-5YAULXB-TA72A72-KQZJDQK" name="max" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
|
||||||
<address>dynamic</address>
|
|
||||||
<paused>false</paused>
|
|
||||||
<autoAcceptFolders>false</autoAcceptFolders>
|
|
||||||
<maxSendKbps>0</maxSendKbps>
|
|
||||||
<maxRecvKbps>0</maxRecvKbps>
|
|
||||||
<maxRequestKiB>0</maxRequestKiB>
|
|
||||||
<untrusted>false</untrusted>
|
|
||||||
<remoteGUIPort>0</remoteGUIPort>
|
|
||||||
</device>
|
|
||||||
<gui enabled="true" tls="false" debugging="false">
|
<gui enabled="true" tls="false" debugging="false">
|
||||||
<address>0.0.0.0:8384</address>
|
<address>0.0.0.0:8384</address>
|
||||||
<apikey></apikey>
|
<apikey></apikey>
|
||||||
|
@ -84,7 +79,6 @@
|
||||||
<urURL>https://data.syncthing.net/newdata</urURL>
|
<urURL>https://data.syncthing.net/newdata</urURL>
|
||||||
<urPostInsecurely>false</urPostInsecurely>
|
<urPostInsecurely>false</urPostInsecurely>
|
||||||
<urInitialDelayS>1800</urInitialDelayS>
|
<urInitialDelayS>1800</urInitialDelayS>
|
||||||
<restartOnWakeup>true</restartOnWakeup>
|
|
||||||
<autoUpgradeIntervalH>12</autoUpgradeIntervalH>
|
<autoUpgradeIntervalH>12</autoUpgradeIntervalH>
|
||||||
<upgradeToPreReleases>false</upgradeToPreReleases>
|
<upgradeToPreReleases>false</upgradeToPreReleases>
|
||||||
<keepTemporariesH>24</keepTemporariesH>
|
<keepTemporariesH>24</keepTemporariesH>
|
||||||
|
@ -117,9 +111,6 @@
|
||||||
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
|
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
|
||||||
<encryptionPassword></encryptionPassword>
|
<encryptionPassword></encryptionPassword>
|
||||||
</device>
|
</device>
|
||||||
<device id="SLEOLPB-5CSPOE5-BMH4KCH-F4DMZWR-VFDQ5OP-5YAULXB-TA72A72-KQZJDQK" introducedBy="">
|
|
||||||
<encryptionPassword></encryptionPassword>
|
|
||||||
</device>
|
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning>
|
<versioning>
|
||||||
<cleanupIntervalS>3600</cleanupIntervalS>
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
@ -147,6 +138,14 @@
|
||||||
<copyRangeMethod>standard</copyRangeMethod>
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
<caseSensitiveFS>false</caseSensitiveFS>
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
<junctionsAsDirs>false</junctionsAsDirs>
|
<junctionsAsDirs>false</junctionsAsDirs>
|
||||||
|
<syncOwnership>false</syncOwnership>
|
||||||
|
<sendOwnership>false</sendOwnership>
|
||||||
|
<syncXattrs>false</syncXattrs>
|
||||||
|
<sendXattrs>false</sendXattrs>
|
||||||
|
<xattrFilter>
|
||||||
|
<maxSingleEntrySize>1024</maxSingleEntrySize>
|
||||||
|
<maxTotalSize>4096</maxTotalSize>
|
||||||
|
</xattrFilter>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>dynamic</address>
|
<address>dynamic</address>
|
||||||
|
@ -158,5 +157,7 @@
|
||||||
<untrusted>false</untrusted>
|
<untrusted>false</untrusted>
|
||||||
<remoteGUIPort>0</remoteGUIPort>
|
<remoteGUIPort>0</remoteGUIPort>
|
||||||
</device>
|
</device>
|
||||||
|
<ignores></ignores>
|
||||||
</defaults>
|
</defaults>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
20
roles/syncthing/files/docker-compose.yml
Normal file
20
roles/syncthing/files/docker-compose.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
version: "2.1"
|
||||||
|
services:
|
||||||
|
syncthing:
|
||||||
|
image: lscr.io/linuxserver/syncthing:latest
|
||||||
|
container_name: syncthing
|
||||||
|
hostname: syncthing
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Amsterdam
|
||||||
|
volumes:
|
||||||
|
- /apps/syncthing/config:/config
|
||||||
|
- /data/syncthing:/data
|
||||||
|
ports:
|
||||||
|
- 8384:8384
|
||||||
|
- 22000:22000/tcp
|
||||||
|
- 22000:22000/udp
|
||||||
|
- 21027:21027/udp
|
||||||
|
restart: unless-stopped
|
3
roles/syncthing/meta/main.yml
Normal file
3
roles/syncthing/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
dependencies:
|
||||||
|
- role: common
|
||||||
|
- role: docker
|
|
@ -1,27 +1,34 @@
|
||||||
- name: Install Syncthing
|
- name: Create Syncthing app directory
|
||||||
apt:
|
file:
|
||||||
name: syncthing
|
path: /apps/syncthing
|
||||||
state: latest
|
state: directory
|
||||||
update_cache: true
|
- name: Create Syncthing configuration directory
|
||||||
- name: Create syncthing user
|
file:
|
||||||
user:
|
path: /apps/syncthing/config
|
||||||
name: syncthing
|
state: directory
|
||||||
home: /home/syncthing
|
|
||||||
state: present
|
|
||||||
- name: Copy Syncthing configuration
|
|
||||||
template:
|
|
||||||
src: "{{ role_path }}/templates/config.xml.j2"
|
|
||||||
dest: /home/syncthing/.config/syncthing/config.xml
|
|
||||||
- name: Copy Syncthing private key
|
- name: Copy Syncthing private key
|
||||||
copy:
|
copy:
|
||||||
src: "{{ role_path }}/files/key.pem"
|
src: "{{ role_path }}/files/key.pem"
|
||||||
dest: /home/syncthing/.config/syncthing/key.pem
|
dest: /apps/syncthing/config/key.pem
|
||||||
- name: Copy Syncthing certificate
|
- name: Copy Syncthing certificate
|
||||||
copy:
|
copy:
|
||||||
src: "{{ role_path }}/files/cert.pem"
|
src: "{{ role_path }}/files/cert.pem"
|
||||||
dest: /home/syncthing/.config/syncthing/cert.pem
|
dest: /apps/syncthing/config/cert.pem
|
||||||
- name: Enable Syncthing service
|
- name: Copy Syncthing configuration
|
||||||
systemd:
|
copy:
|
||||||
name: syncthing@syncthing
|
src: "{{ role_path }}/files/config.xml"
|
||||||
enabled: true
|
dest: /apps/syncthing/config/config.xml
|
||||||
state: restarted
|
- name: Create Syncthing data directory
|
||||||
|
file:
|
||||||
|
path: /data/syncthing
|
||||||
|
state: directory
|
||||||
|
mode: 0777
|
||||||
|
- name: Copy docker compose script
|
||||||
|
copy:
|
||||||
|
src: "{{ role_path }}/files/docker-compose.yml"
|
||||||
|
dest: /apps/syncthing/docker-compose.yml
|
||||||
|
- name: Start Docker Compose
|
||||||
|
docker_compose:
|
||||||
|
project_src: /apps/syncthing
|
||||||
|
pull: true
|
||||||
|
remove_orphans: true
|
||||||
|
|
Reference in a new issue