From 0ae1c4c56b2df6e0dc5dd330da57bcfe935a7517 Mon Sep 17 00:00:00 2001 From: Mike Wilson Date: Tue, 21 Feb 2023 17:31:13 -0500 Subject: [PATCH] Added qbitmanage and fixed cross-seed thing --- .../roles/ntfy/templates/docker-compose.yml | 4 +- .../qbittorrent/files/qbitmanage/config.yml | 107 ++++++++++++++++++ ansible/roles/qbittorrent/tasks/main.yml | 10 +- .../qbittorrent/templates/docker-compose.yml | 45 ++++++-- .../traefik/templates/conf/middlewares.yml | 1 + 5 files changed, 158 insertions(+), 9 deletions(-) create mode 100755 ansible/roles/qbittorrent/files/qbitmanage/config.yml diff --git a/ansible/roles/ntfy/templates/docker-compose.yml b/ansible/roles/ntfy/templates/docker-compose.yml index 813cff9..c8c554c 100644 --- a/ansible/roles/ntfy/templates/docker-compose.yml +++ b/ansible/roles/ntfy/templates/docker-compose.yml @@ -14,10 +14,12 @@ services: user: "{{ primary_uid }}:{{ primary_gid }}" environment: - TZ={{ timezone }} + command: + - serve volumes: - "{{ data_dir }}/ntfy:/etc/ntfy" - /var/cache/ntfy:/var/cache/ntfy labels: traefik.enable: true - traefik.http.routers.ntfy.rule: "Host(`ntfy.{{ personal_domain }}`)" + traefik.http.routers.ntfy.rule: "Host(`push.{{ personal_domain }}`)" traefik.http.routers.ntfy.middlewares: lan-whitelist@file diff --git a/ansible/roles/qbittorrent/files/qbitmanage/config.yml b/ansible/roles/qbittorrent/files/qbitmanage/config.yml new file mode 100755 index 0000000..6aab7e3 --- /dev/null +++ b/ansible/roles/qbittorrent/files/qbitmanage/config.yml @@ -0,0 +1,107 @@ +qbt: + host: https://qbittorrent.local.mjwilson.org + user: + pass: + +settings: + force_auto_tmm: false # Will force qBittorrent to enable Automatic Torrent Management for each torrent. + tracker_error_tag: issue # Will set the tag of any torrents that do not have a working tracker. + ignoreTags_OnUpdate: # When running tag-update function, it will update torrent tags for a given torrent even if the torrent has one or more of the tags defined here. + - noHL + - issue + - cross-seed + +directory: + root_dir: /data/torrents + torrents_dir: /torrents + remote_dir: /data/torrents/ + cross_seed: + recycle_bin: /data/torrents/.RecycleBin + +cat: + movies: /data/torrents/movies + tv: /data/torrents/tv + music: /data/torrents/music + + torrents: /data/torrents/ +tracker: + digitalcore: + tag: DigitalCore + hdts: + tag: HDTorrents + myanonamouse: + tag: MaM + tleechreload: + tag: TorrentLeech + torrentleech: + tag: TorrentLeech + notifiarr: torrentleech + aither: + tag: Aither + nyaa: + tag: Nyaa + animetosho: + tag: AnimeTosho + immortalseed: + tag: ImmortalSeed + torrentseeds: + tag: TorrentSeeds + ops: + tag: Orpheus + t-ru: + tag: RuTracker + rarbg: + tag: RarBG + +nohardlinks: + movies: + cleanup: true + max_ratio: 4.0 + max_seeding_time: 43200 # 30 days + min_seeding_time: 43200 + resume_torrent_after_untagging_noHL: true + exclude_tags: + tv: + cleanup: true + max_ratio: 4.0 + max_seeding_time: 43200 + min_seeding_time: 43200 + resume_torrent_after_untagging_noHL: true + exclude_tags: + music: + cleanup: true + max_ratio: 4.0 + max_seeding_time: 43200 + min_seeding_time: 43200 + resume_torrent_after_untagging_noHL: true + exclude_tags: + +recyclebin: + enabled: true + empty_after_x_days: 7 + save_torrents: true + split_by_category: false + +orphaned: + empty_after_x_days: 30 + exclude_patterns: + - '**/.DS_Store' + - '**/Thumbs.db' + - '**/@eaDir' + - /data/torrents/temp/** + - '**/*.!qB' + +webhooks: + error: + run_start: + run_end: + function: + cross_seed: + recheck: + cat_update: + tag_update: + rem_unregistered: + tag_tracker_error: + rem_orphaned: + tag_nohardlinks: + cleanup_dirs: diff --git a/ansible/roles/qbittorrent/tasks/main.yml b/ansible/roles/qbittorrent/tasks/main.yml index bf946a1..52fe236 100644 --- a/ansible/roles/qbittorrent/tasks/main.yml +++ b/ansible/roles/qbittorrent/tasks/main.yml @@ -24,7 +24,15 @@ validate: docker-compose -f %s config become: true -- name: Start docker container +- name: Install qbitmanage config file + copy: + src: qbitmanage/config.yml + dest: "{{ data_dir }}/qbitmanage/config.yml" + owner: "{{ service_user.uid }}" + mode: "{{ docker_compose_file_mask }}" + become: true + +- name: Start docker containers community.docker.docker_compose: project_src: "{{ install_directory }}/{{ role_name }}" pull: true diff --git a/ansible/roles/qbittorrent/templates/docker-compose.yml b/ansible/roles/qbittorrent/templates/docker-compose.yml index dd1cfa8..2f7b2b5 100644 --- a/ansible/roles/qbittorrent/templates/docker-compose.yml +++ b/ansible/roles/qbittorrent/templates/docker-compose.yml @@ -1,12 +1,8 @@ version: "{{ docker_compose_version }}" -networks: - traefik: - external: true - services: - {{ role_name }}: - container_name: "{{ role_name }}" + qbittorrent: + container_name: qbittorrent image: lscr.io/linuxserver/qbittorrent:libtorrentv1 restart: unless-stopped network_mode: "container:gluetun" @@ -14,7 +10,7 @@ services: - "PUID={{ service_user.uid }}" - "PGID={{ media_gid }}" - "TZ={{ timezone }}" - - DOCKER_MODS=arafatamim/linuxserver-io-mod-vuetorrent + #- DOCKER_MODS=arafatamim/linuxserver-io-mod-vuetorrent volumes: - "{{ data_dir }}/{{ role_name }}:/config" - "{{ media_storage_mnt }}/data/torrents:/data/torrents" @@ -23,3 +19,38 @@ services: traefik.http.routers.{{ role_name }}.rule: "Host(`{{ role_name }}.local.{{ personal_domain }}`)" traefik.http.routers.{{ role_name }}.middlewares: lan-whitelist@file traefik.http.services.qbittorrent.loadbalancer.server.port: 8080 + + qbitmanage: + container_name: qbitmanage + image: cr.hotio.dev/hotio/qbitmanage + restart: unless-stopped + environment: + PUID: "{{ service_user.uid }}" + PGID: "{{ service_user.uid }}" + UMASK: 002 + TZ: "{{ timezone }}" + QBT_DRY_RUN: "False" + QBT_SCHEDULE: 720 + QBT_RECHECK: "True" + QBT_TAG_UPDATE: "True" + QBT_REM_UNREGISTERED: "True" + QBT_REMOVE_ORPHANED: "True" + QBT_TAG_NOHARDLINKS: "True" + + volumes: + - "{{ data_dir }}/qbitmanage:/config" + - "{{ media_storage_mnt }}/data/torrents:/data/torrents" # root_dir + - "{{ data_dir }}/qbittorrent/qBittorrent/BT_backup:/torrents" # torrents_dir + + cross-seed: + container_name: cross-seed + depends_on: + - qbittorrent + image: crossseed/cross-seed + user: "{{ service_user.uid }}:{{ service_user.uid }}" + volumes: + - "{{ data_dir }}/cross-seed:/config" + - "{{ data_dir }}/qbittorrent/qBittorrent/BT_backup:/torrents" + - "{{ data_dir }}/cross-seed/output:/cross-seeds" + command: daemon + restart: unless-stopped diff --git a/ansible/roles/traefik/templates/conf/middlewares.yml b/ansible/roles/traefik/templates/conf/middlewares.yml index 66d8846..6aec19f 100644 --- a/ansible/roles/traefik/templates/conf/middlewares.yml +++ b/ansible/roles/traefik/templates/conf/middlewares.yml @@ -5,6 +5,7 @@ http: sourceRange: - 10.0.0.0/24 - 10.67.115.0/24 + - 172.16.0.0/12 secure-headers: headers: