diff --git a/roles/qbittorrent/tasks/main.yml b/roles/qbittorrent/tasks/main.yml index 7f7cd7f..ed8a870 100644 --- a/roles/qbittorrent/tasks/main.yml +++ b/roles/qbittorrent/tasks/main.yml @@ -10,6 +10,43 @@ - "{{ qbittorrent_downloads_dir }}" tags: qbittorrent +- name: Create initial qBittorrent configuration + copy: + content: | + # Auto-generated qBittorrent configuration + [AutoRun] + enabled=false + + [BitTorrent] + Session\DefaultSavePath=/downloads + Session\Port={{ qbittorrent_port_torrent }} + + [Core] + AutoDeleteAddedTorrentFile=Never + + [LegalNotice] + Accepted=true + + [Preferences] + Connection\PortRangeMin={{ qbittorrent_port_torrent }} + Connection\PortRangeMax={{ qbittorrent_port_torrent }} + Downloads\SavePath=/downloads + Downloads\TempPath=/downloads/incomplete + WebUI\Address=* + WebUI\Port=8080 + WebUI\LocalHostAuth=false + WebUI\AuthSubnetWhitelist=192.168.1.0/24 + WebUI\UseUPnP=false + WebUI\ClickjackingProtection=false + WebUI\CSRFProtection=false + WebUI\HostHeaderValidation=false + WebUI\DomainList=192.168.1.201:{{ qbittorrent_port_webui }},localhost:{{ qbittorrent_port_webui }} + WebUI\MaxAuthenticationFailCount=-1 + Advanced\RecheckOnCompletion=false + dest: "{{ qbittorrent_config_dir }}/qBittorrent.conf" + mode: '0644' + tags: qbittorrent + - name: Deploy docker-compose.yml template: src: docker-compose.yml.j2 @@ -25,6 +62,8 @@ state: present pull: "always" build: "never" + recreate: "always" + remove_orphans: yes tags: qbittorrent - name: Wait for qBittorrent to start @@ -34,13 +73,6 @@ state: started tags: qbittorrent -- name: Get temporary password from logs - shell: | - docker logs qbittorrent 2>&1 | grep "temporary password" | tail -1 | awk '{print $NF}' - register: temp_password - changed_when: false - tags: qbittorrent - - name: Display access information debug: msg: | @@ -48,10 +80,9 @@ 🔗 Доступ: http://{{ ansible_host }}:{{ qbittorrent_port_webui }} 👤 Имя пользователя: admin - 🔑 Временный пароль: {{ temp_password.stdout }} + 🔑 Пароль: adminadmin - ⚠️ ВАЖНО: Войдите немедленно и смените пароль в веб-интерфейсе! - Этот временный пароль изменится при перезапуске контейнера. + ⚠️ ВАЖНО: Смените пароль после первого входа! 📁 Директории: - Конфигурация: {{ qbittorrent_config_dir }} diff --git a/roles/qbittorrent/templates/docker-compose.yml.j2 b/roles/qbittorrent/templates/docker-compose.yml.j2 index 473ff81..b0b9e29 100644 --- a/roles/qbittorrent/templates/docker-compose.yml.j2 +++ b/roles/qbittorrent/templates/docker-compose.yml.j2 @@ -8,14 +8,11 @@ services: - PGID={{ qbittorrent_pgid }} - TZ={{ timezone }} - WEBUI_PORT=8080 - - TORRENTING_PORT=6881 - - WEBUI_USE_IP_HEADER=1 - - WEBUI_HOST_HEADER= volumes: - {{ qbittorrent_config_dir }}:/config - {{ qbittorrent_downloads_dir }}:/downloads ports: - {{ qbittorrent_port_webui }}:8080 - - 6881:6881 - - 6881:6881/udp + - {{ qbittorrent_port_torrent }}:6881 + - {{ qbittorrent_port_torrent }}:6881/udp restart: unless-stopped \ No newline at end of file