Update 3 files

- /roles/qbittorrent/templates/docker-compose.yml.j2
- /roles/qbittorrent/tasks/main.yml
- /group_vars/all.yml
This commit is contained in:
Administrator 2025-12-08 11:18:02 +05:00
parent c3e138bd81
commit 91fbd82b42
3 changed files with 31 additions and 83 deletions

View File

@ -142,13 +142,12 @@ dashy_port: "45132"
dashy_domain: "start.zailon.ru" dashy_domain: "start.zailon.ru"
--- ---
qbittorrent_base_dir: "/mnt/qbittorrent" qbittorrent_base_dir: "/opt/qbittorrent"
qbittorrent_config_dir: "{{ qbittorrent_base_dir }}/config" qbittorrent_config_dir: "{{ qbittorrent_base_dir }}/appdata"
qbittorrent_downloads_dir: "{{ qbittorrent_base_dir }}/downloads" qbittorrent_downloads_dir: "{{ qbittorrent_base_dir }}/downloads"
qbittorrent_puid: 1000
qbittorrent_pgid: 1000
qbittorrent_port_webui: 45133 qbittorrent_port_webui: 45133
qbittorrent_port_torrent: 6881
qbittorrent_webui_username: "zailon"
qbittorrent_webui_password: "13qeadZC"
# ------------ data (192.168.1.202) ------------ # ------------ data (192.168.1.202) ------------
bookstack_base_dir: "/mnt/bookstack" bookstack_base_dir: "/mnt/bookstack"

View File

@ -5,97 +5,55 @@
state: directory state: directory
mode: '0755' mode: '0755'
loop: loop:
- "{{ qbittorrent_base_dir }}"
- "{{ qbittorrent_config_dir }}" - "{{ qbittorrent_config_dir }}"
- "{{ qbittorrent_downloads_dir }}" - "{{ qbittorrent_downloads_dir }}"
tags: qbittorrent tags: qbittorrent
- name: Create docker-compose.yml for qBittorrent - name: Deploy docker-compose.yml
template: template:
src: docker-compose.yml.j2 src: docker-compose.yml.j2
dest: "{{ qbittorrent_base_dir }}/docker-compose.yml" dest: "{{ qbittorrent_base_dir }}/docker-compose.yml"
owner: root
group: root
mode: '0644'
tags: qbittorrent tags: qbittorrent
- name: Deploy qBittorrent with docker compose - name: Start qBittorrent container with docker compose
community.docker.docker_compose_v2: community.docker.docker_compose_v2:
project_src: "{{ qbittorrent_base_dir }}" project_src: "{{ qbittorrent_base_dir }}"
state: present state: present
build: never pull: "always"
pull: always build: "never"
recreate: always
remove_orphans: yes
tags: qbittorrent tags: qbittorrent
- name: Wait for qBittorrent to start - name: Wait for qBittorrent to start
wait_for: wait_for:
port: "{{ qbittorrent_port_web }}" port: "{{ qbittorrent_port_webui }}"
timeout: 60 timeout: 60
state: started state: started
tags: qbittorrent tags: qbittorrent
- name: Check qBittorrent health with retry - name: Get temporary password from logs
uri: shell: |
url: "http://localhost:{{ qbittorrent_port_web }}" docker logs qbittorrent 2>&1 | grep "temporary password" | tail -1 | awk '{print $NF}'
status_code: [200, 401, 403] register: temp_password
timeout: 5 changed_when: false
register: qbittorrent_health
until: qbittorrent_health.status == 200 or qbittorrent_health.status == 401
retries: 12
delay: 5
tags: qbittorrent tags: qbittorrent
- name: Display qBittorrent deployment success - name: Display access information
debug: debug:
msg: | msg: |
✅ qBittorrent успешно развернут! ✅ qBittorrent успешно развернут!
📊 Статус сервиса: 🔗 Доступ: http://{{ ansible_host }}:{{ qbittorrent_port_webui }}
- Веб-интерфейс: http://{{ ansible_host }}:{{ qbittorrent_port_web }} 👤 Имя пользователя: admin
- HTTP статус: {{ qbittorrent_health.status }} 🔑 Временный пароль: {{ temp_password.stdout }}
- Контейнер: qbittorrent
🔐 Учетные данные по умолчанию: ⚠️ ВАЖНО: Войдите немедленно и смените пароль в веб-интерфейсе!
- Логин: admin Этот временный пароль изменится при перезапуске контейнера.
- Пароль: adminadmin
⚠️ ВНИМАНИЕ: Смените пароль после первого входа!
📁 Директории: 📁 Директории:
- Конфигурация: {{ qbittorrent_config_dir }} - Конфигурация: {{ qbittorrent_config_dir }}
- Загрузки: {{ qbittorrent_downloads_dir }} - Загрузки: {{ qbittorrent_downloads_dir }}
🔧 Команды управления:
- Остановить: docker stop qbittorrent
- Запустить: docker start qbittorrent
- Перезапустить: docker restart qbittorrent
tags: qbittorrent
- name: Create access info file
copy:
content: |
# qBittorrent Access Information
# Generated by Ansible on {{ ansible_date_time.date }}
Web Interface: http://{{ ansible_host }}:{{ qbittorrent_port_web }}
Default Username: admin
Default Password: adminadmin
IMPORTANT: Change the default password after first login!
Directories:
Config: {{ qbittorrent_config_dir }}
Downloads: {{ qbittorrent_downloads_dir }}
Docker Commands:
Status: docker ps | grep qbittorrent
Logs: docker logs qbittorrent
Restart: docker restart qbittorrent
First Steps:
1. Open http://{{ ansible_host }}:{{ qbittorrent_port_web }}
2. Login with admin/adminadmin
3. Go to Tools → Options → Web UI
4. Change the password
5. Configure download directory: {{ qbittorrent_downloads_dir }}
dest: "{{ qbittorrent_base_dir }}/ACCESS_INFO.txt"
mode: '0644'
tags: qbittorrent tags: qbittorrent

View File

@ -4,25 +4,16 @@ services:
image: lscr.io/linuxserver/qbittorrent:latest image: lscr.io/linuxserver/qbittorrent:latest
container_name: qbittorrent container_name: qbittorrent
environment: environment:
- PUID=1000 - PUID={{ qbittorrent_puid }}
- PGID=1000 - PGID={{ qbittorrent_pgid }}
- TZ={{ timezone }} - TZ={{ timezone }}
- WEBUI_PORT={{ qbittorrent_port_webui }} - WEBUI_PORT=8080
- WEBUI_USERNAME={{ qbittorrent_webui_username }}
- WEBUI_PASSWORD={{ qbittorrent_webui_password }}
- TORRENTING_PORT=6881 - TORRENTING_PORT=6881
volumes: volumes:
- {{ qbittorrent_config_dir }}:/config - {{ qbittorrent_config_dir }}:/config
- {{ qbittorrent_downloads_dir }}:/downloads - {{ qbittorrent_downloads_dir }}:/downloads
ports: ports:
- {{ qbittorrent_port_web }}:8080 - {{ qbittorrent_port_webui }}:8080
- {{ qbittorrent_port_tcp }}:6881 - 6881:6881
- {{ qbittorrent_port_udp }}:6881/udp - 6881:6881/udp
restart: unless-stopped restart: unless-stopped
networks:
- default
networks:
default:
name: qbittorrent_network
driver: bridge