use docker compose for syncthing

create /apps and /data directory
This commit is contained in:
Pim Kunis 2022-12-03 14:50:43 +01:00
parent 62f014d90f
commit a3e4b8d822
5 changed files with 72 additions and 41 deletions

View file

@ -2,7 +2,7 @@
git:
repo: https://github.com/pizzapim/pizzeria
dest: /apps/pizzeria
- name: Start the Docker compose
- name: Start the Docker Compose
community.docker.docker_compose:
project_src: /apps/pizzeria
pull: true

View file

@ -1,12 +1,9 @@
<configuration version="35">
<folder id="wdadm-ywcr4" label="sync" path="/home/syncthing/sync" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
<configuration version="37">
<folder id="n2mbz-tyboq" label="data" path="/data" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
<filesystemType>basic</filesystemType>
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
<encryptionPassword></encryptionPassword>
</device>
<device id="SLEOLPB-5CSPOE5-BMH4KCH-F4DMZWR-VFDQ5OP-5YAULXB-TA72A72-KQZJDQK" introducedBy="">
<encryptionPassword></encryptionPassword>
</device>
<minDiskFree unit="%">1</minDiskFree>
<versioning>
<cleanupIntervalS>3600</cleanupIntervalS>
@ -34,6 +31,14 @@
<copyRangeMethod>standard</copyRangeMethod>
<caseSensitiveFS>false</caseSensitiveFS>
<junctionsAsDirs>false</junctionsAsDirs>
<syncOwnership>false</syncOwnership>
<sendOwnership>false</sendOwnership>
<syncXattrs>false</syncXattrs>
<sendXattrs>false</sendXattrs>
<xattrFilter>
<maxSingleEntrySize>1024</maxSingleEntrySize>
<maxTotalSize>4096</maxTotalSize>
</xattrFilter>
</folder>
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" name="max" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
<address>dynamic</address>
@ -45,16 +50,6 @@
<untrusted>false</untrusted>
<remoteGUIPort>0</remoteGUIPort>
</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">
<address>0.0.0.0:8384</address>
<apikey></apikey>
@ -84,7 +79,6 @@
<urURL>https://data.syncthing.net/newdata</urURL>
<urPostInsecurely>false</urPostInsecurely>
<urInitialDelayS>1800</urInitialDelayS>
<restartOnWakeup>true</restartOnWakeup>
<autoUpgradeIntervalH>12</autoUpgradeIntervalH>
<upgradeToPreReleases>false</upgradeToPreReleases>
<keepTemporariesH>24</keepTemporariesH>
@ -117,9 +111,6 @@
<device id="IGS4TYV-TQ6X2CG-OE3M2RE-DKZWKQZ-HEKIGHT-C6EIGHL-CBP2ULE-M3WZ7QC" introducedBy="">
<encryptionPassword></encryptionPassword>
</device>
<device id="SLEOLPB-5CSPOE5-BMH4KCH-F4DMZWR-VFDQ5OP-5YAULXB-TA72A72-KQZJDQK" introducedBy="">
<encryptionPassword></encryptionPassword>
</device>
<minDiskFree unit="%">1</minDiskFree>
<versioning>
<cleanupIntervalS>3600</cleanupIntervalS>
@ -147,6 +138,14 @@
<copyRangeMethod>standard</copyRangeMethod>
<caseSensitiveFS>false</caseSensitiveFS>
<junctionsAsDirs>false</junctionsAsDirs>
<syncOwnership>false</syncOwnership>
<sendOwnership>false</sendOwnership>
<syncXattrs>false</syncXattrs>
<sendXattrs>false</sendXattrs>
<xattrFilter>
<maxSingleEntrySize>1024</maxSingleEntrySize>
<maxTotalSize>4096</maxTotalSize>
</xattrFilter>
</folder>
<device id="" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
<address>dynamic</address>
@ -158,5 +157,7 @@
<untrusted>false</untrusted>
<remoteGUIPort>0</remoteGUIPort>
</device>
<ignores></ignores>
</defaults>
</configuration>

View 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

View file

@ -0,0 +1,3 @@
dependencies:
- role: common
- role: docker

View file

@ -1,27 +1,34 @@
- name: Install Syncthing
apt:
name: syncthing
state: latest
update_cache: true
- name: Create syncthing user
user:
name: syncthing
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: Create Syncthing app directory
file:
path: /apps/syncthing
state: directory
- name: Create Syncthing configuration directory
file:
path: /apps/syncthing/config
state: directory
- name: Copy Syncthing private key
copy:
src: "{{ role_path }}/files/key.pem"
dest: /home/syncthing/.config/syncthing/key.pem
dest: /apps/syncthing/config/key.pem
- name: Copy Syncthing certificate
copy:
src: "{{ role_path }}/files/cert.pem"
dest: /home/syncthing/.config/syncthing/cert.pem
- name: Enable Syncthing service
systemd:
name: syncthing@syncthing
enabled: true
state: restarted
dest: /apps/syncthing/config/cert.pem
- name: Copy Syncthing configuration
copy:
src: "{{ role_path }}/files/config.xml"
dest: /apps/syncthing/config/config.xml
- 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