From 77fe92a7e7b8a88533db36a6b91730f20ff40033 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 9 Feb 2020 13:06:10 +0000 Subject: [PATCH] Add torrent (deluge) config --- .../docker/files/torrent/docker-compose.yml | 26 ++++++++++++++++ ansible/roles/docker/tasks/main.yml | 3 ++ ansible/roles/docker/tasks/torrent.yml | 31 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 ansible/roles/docker/files/torrent/docker-compose.yml create mode 100644 ansible/roles/docker/tasks/torrent.yml diff --git a/ansible/roles/docker/files/torrent/docker-compose.yml b/ansible/roles/docker/files/torrent/docker-compose.yml new file mode 100644 index 0000000..71e636d --- /dev/null +++ b/ansible/roles/docker/files/torrent/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3" +services: + deluge: + image: linuxserver/deluge:2.0.3-2201906121747ubuntu18.04.1-ls47 + container_name: deluge + environment: + - PUID={{ docker_user.id }} + - PGID={{ docker_user.id }} + - TZ=Europe/London + - DELUGE_LOGLEVEL=debug + volumes: + - ./deluge:/config + - /scratch/deluge:/downloads + ports: + - 8112:8112 + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.deluge.rule=Host(`deluge.jakehoward.tech`)" + - "traefik.http.routers.deluge.tls=true" + - "traefik.http.routers.deluge.tls.certresolver=le" + - "traefik.http.routers.deluge.middlewares=internal-only@file" + + tor-socks-proxy: + image: peterdavehello/tor-socks-proxy:latest + restart: unless-stopped diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index 08779b7..19cb2cb 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -42,3 +42,6 @@ - name: Install tt-rss include: tt-rss.yml + +- name: Install torrent + include: torrent.yml diff --git a/ansible/roles/docker/tasks/torrent.yml b/ansible/roles/docker/tasks/torrent.yml new file mode 100644 index 0000000..32d13f6 --- /dev/null +++ b/ansible/roles/docker/tasks/torrent.yml @@ -0,0 +1,31 @@ +- name: Create torrent directory + file: + path: '/opt/torrent' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install torrent compose file + template: + src: files/torrent/docker-compose.yml + dest: "/opt/torrent/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 torrent container + docker_compose: + project_src: /opt/torrent + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present