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

@ -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