olimp/roles/qbittorrent/tasks/main.yml
Administrator 07e9e9c86a Update 2 files
- /roles/qbittorrent/tasks/main.yml
- /roles/qbittorrent/templates/docker-compose.yml.j2
2025-12-08 12:51:13 +05:00

90 lines
2.6 KiB
YAML

---
- name: Create qBittorrent directories
file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ qbittorrent_base_dir }}"
- "{{ qbittorrent_config_dir }}"
- "{{ 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
dest: "{{ qbittorrent_base_dir }}/docker-compose.yml"
owner: root
group: root
mode: '0644'
tags: qbittorrent
- name: Start qBittorrent container with docker compose
community.docker.docker_compose_v2:
project_src: "{{ qbittorrent_base_dir }}"
state: present
pull: "always"
build: "never"
recreate: "always"
remove_orphans: yes
tags: qbittorrent
- name: Wait for qBittorrent to start
wait_for:
port: "{{ qbittorrent_port_webui }}"
timeout: 60
state: started
tags: qbittorrent
- name: Display access information
debug:
msg: |
✅ qBittorrent успешно развернут!
🔗 Доступ: http://{{ ansible_host }}:{{ qbittorrent_port_webui }}
👤 Имя пользователя: admin
🔑 Пароль: adminadmin
⚠️ ВАЖНО: Смените пароль после первого входа!
📁 Директории:
- Конфигурация: {{ qbittorrent_config_dir }}
- Загрузки: {{ qbittorrent_downloads_dir }}
tags: qbittorrent