59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
---
|
||
- 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)" |