diff --git a/ansible/roles/docker/files/gotify/docker-compose.yml b/ansible/roles/docker/files/gotify/docker-compose.yml new file mode 100644 index 0000000..c93ddfa --- /dev/null +++ b/ansible/roles/docker/files/gotify/docker-compose.yml @@ -0,0 +1,17 @@ +version: "2" +services: + duplicati: + image: gotify/server:2.0.13 + container_name: gotify + environment: + - PUID=3000 + - PGID=3000 + - TZ=Europe/London + volumes: + - ./data:/app/data + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.gotify.rule=Host(`gotify.jakehoward.tech`)" + - "traefik.http.routers.gotify.tls=true" + - "traefik.http.routers.gotify.tls.certresolver=le" diff --git a/ansible/roles/docker/tasks/gotify.yml b/ansible/roles/docker/tasks/gotify.yml new file mode 100644 index 0000000..b0aecca --- /dev/null +++ b/ansible/roles/docker/tasks/gotify.yml @@ -0,0 +1,31 @@ +- name: Create gotify directory + file: + path: '/opt/gotify' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install gotify compose file + template: + src: files/gotify/docker-compose.yml + dest: "/opt/gotify/docker-compose.yml" + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + register: compose_file + become: true + become_user: root + +- name: Cycle gotify container + docker_compose: + project_src: /opt/gotify + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index 4cd5bc9..376bc06 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -24,3 +24,6 @@ - name: Install librespeed include: librespeed.yml + +- name: Install gotify + include: gotify.yml