39 lines
862 B
YAML
39 lines
862 B
YAML
- name: Create working directory
|
|
file:
|
|
path: /srv/syncthing
|
|
state: directory
|
|
|
|
- name: Copy config file
|
|
template:
|
|
src: "{{ role_path }}/config.xml.j2"
|
|
dest: /srv/syncthing/config.xml
|
|
register: config
|
|
|
|
- name: Copy private key
|
|
copy:
|
|
src: "{{ role_path }}/key.pem"
|
|
dest: /srv/syncthing/key.pem
|
|
register: privkey
|
|
|
|
- name: Copy certificate
|
|
copy:
|
|
src: "{{ role_path }}/cert.pem"
|
|
dest: /srv/syncthing/cert.pem
|
|
register: cert
|
|
|
|
- name: Copy Docker stack file
|
|
template:
|
|
src: "{{ role_path }}/docker-stack.yml.j2"
|
|
dest: /srv/syncthing/docker-stack.yml
|
|
|
|
- name: Remove docker stack
|
|
docker_stack:
|
|
name: syncthing
|
|
state: absent
|
|
when: config.changed or privkey.changed or cert.changed
|
|
|
|
- name: Deploy Docker stack
|
|
docker_stack:
|
|
name: syncthing
|
|
compose:
|
|
- /srv/syncthing/docker-stack.yml
|