olimp/roles/qbittorrent/tasks/main.yml
2025-12-18 13:55:08 +05:00

59 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: Создание директорий для qBittorrent
file:
path: "{{ item }}"
state: directory
owner: "{{ qbittorrent_puid }}"
group: "{{ qbittorrent_pgid }}"
mode: '0755'
loop:
- "{{ qbittorrent_config_dir }}"
- "{{ qbittorrent_downloads_dir }}"
- name: Создание директории для учетных данных SMB
file:
path: "{{ qbittorrent_smb_credentials_dir }}"
state: directory
mode: '0700'
- name: Создание файлов учетных данных SMB
template:
src: smb-credentials.j2
dest: "{{ qbittorrent_smb_credentials_dir }}/{{ item.key }}"
mode: '0600'
loop: "{{ qbittorrent_smb_creds | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Монтирование SMB-шаров
mount:
path: "{{ item.dest }}"
src: "{{ item.src }}"
fstype: cifs
opts: "{{ item.opts }}{% if item.credential is defined %},credentials={{ qbittorrent_smb_credentials_dir }}/{{ item.credential }}{% endif %}"
state: mounted
loop: "{{ qbittorrent_shares }}"
loop_control:
label: "{{ item.name }}"
- name: Копирование docker-compose файла для qBittorrent
template:
src: docker-compose.yml.j2
dest: "{{ qbittorrent_base_dir }}/docker-compose.yml"
mode: '0644'
- name: Запуск qBittorrent контейнера
community.docker.docker_compose_v2:
project_src: "{{ qbittorrent_base_dir }}"
state: present
- name: Ожидание запуска qBittorrent
wait_for:
port: "{{ qbittorrent_port_webui }}"
timeout: 60
- name: Информация о подключении
debug:
msg: |
"%s\n%s\n" "qBittorrent запущен!""
"Веб-интерфейс: http://{{ ansible_host }}:{{ qbittorrent_port_webui }}" "Логин по умолчанию: admin" "Временный пароль: (проверь docker logs qbittorren)"