101 lines
3.1 KiB
YAML
101 lines
3.1 KiB
YAML
---
|
||
- name: Create qBittorrent directories
|
||
file:
|
||
path: "{{ item }}"
|
||
state: directory
|
||
mode: '0755'
|
||
loop:
|
||
- "{{ qbittorrent_config_dir }}"
|
||
- "{{ qbittorrent_downloads_dir }}"
|
||
tags: qbittorrent
|
||
|
||
- name: Create docker-compose.yml for qBittorrent
|
||
template:
|
||
src: docker-compose.yml.j2
|
||
dest: "{{ qbittorrent_base_dir }}/docker-compose.yml"
|
||
tags: qbittorrent
|
||
|
||
- name: Deploy qBittorrent with docker compose
|
||
community.docker.docker_compose_v2:
|
||
project_src: "{{ qbittorrent_base_dir }}"
|
||
state: present
|
||
build: never
|
||
pull: always
|
||
recreate: always
|
||
remove_orphans: yes
|
||
tags: qbittorrent
|
||
|
||
- name: Wait for qBittorrent to start
|
||
wait_for:
|
||
port: "{{ qbittorrent_port_web }}"
|
||
timeout: 60
|
||
state: started
|
||
tags: qbittorrent
|
||
|
||
- name: Check qBittorrent health with retry
|
||
uri:
|
||
url: "http://localhost:{{ qbittorrent_port_web }}"
|
||
status_code: [200, 401, 403]
|
||
timeout: 5
|
||
register: qbittorrent_health
|
||
until: qbittorrent_health.status == 200 or qbittorrent_health.status == 401
|
||
retries: 12
|
||
delay: 5
|
||
tags: qbittorrent
|
||
|
||
- name: Display qBittorrent deployment success
|
||
debug:
|
||
msg: |
|
||
✅ qBittorrent успешно развернут!
|
||
|
||
📊 Статус сервиса:
|
||
- Веб-интерфейс: http://{{ ansible_host }}:{{ qbittorrent_port_web }}
|
||
- HTTP статус: {{ qbittorrent_health.status }}
|
||
- Контейнер: qbittorrent
|
||
|
||
🔐 Учетные данные по умолчанию:
|
||
- Логин: admin
|
||
- Пароль: adminadmin
|
||
|
||
⚠️ ВНИМАНИЕ: Смените пароль после первого входа!
|
||
|
||
📁 Директории:
|
||
- Конфигурация: {{ qbittorrent_config_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 |