Skip to content

Commit

Permalink
qbittorrent: track assigned torrent port since client does not always…
Browse files Browse the repository at this point in the history
… bind it in time

Should prevent duplicate assignments since we check for LISTEN ports.
  • Loading branch information
saltydk committed Aug 28, 2024
1 parent bf0a216 commit 4542340
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion roles/qbittorrent/tasks/subtasks/pre-install/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
path: "/opt/traefik/{{ qbittorrent_name }}.yml"
state: absent

- name: Pre-Install | Initialize or update port range low bound
ansible.builtin.set_fact:
port_range_low_bound: "{{ port_range_low_bound | default(56881) }}"

- name: Pre-Install | Get next available port within the range of '56881-56901' # noqa fqcn[action]
find_open_port:
low_bound: 56881
low_bound: "{{ port_range_low_bound }}"
high_bound: 56901
protocol: both
register: port_lookup_56881
ignore_errors: true

- name: Pre-Install | Update port range low bound for next iteration
ansible.builtin.set_fact:
port_range_low_bound: "{{ (lookup('vars', qbittorrent_name + '_docker_ports_56881', default=qbittorrent_docker_ports_56881) | int) + 1 }}"

- name: Pre-Install | Get next available port within the range of '8080-8090' # noqa fqcn[action]
find_open_port:
low_bound: 8080
Expand Down

0 comments on commit 4542340

Please sign in to comment.