- /roles/qbittorrent/templates/docker-compose.yml.j2 - /roles/qbittorrent/tasks/main.yml - /group_vars/all.yml
59 lines
1.8 KiB
YAML
59 lines
1.8 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: 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"
|
|
tags: qbittorrent
|
|
|
|
- name: Wait for qBittorrent to start
|
|
wait_for:
|
|
port: "{{ qbittorrent_port_webui }}"
|
|
timeout: 60
|
|
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: |
|
|
✅ qBittorrent успешно развернут!
|
|
|
|
🔗 Доступ: http://{{ ansible_host }}:{{ qbittorrent_port_webui }}
|
|
👤 Имя пользователя: admin
|
|
🔑 Временный пароль: {{ temp_password.stdout }}
|
|
|
|
⚠️ ВАЖНО: Войдите немедленно и смените пароль в веб-интерфейсе!
|
|
Этот временный пароль изменится при перезапуске контейнера.
|
|
|
|
📁 Директории:
|
|
- Конфигурация: {{ qbittorrent_config_dir }}
|
|
- Загрузки: {{ qbittorrent_downloads_dir }}
|
|
tags: qbittorrent |