Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert rfloodx and requestrrx to multi instance #282

Merged
merged 5 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions roles/requestrr/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Basics
################################

requestrr_name: requestrr
requestrr_instances: ["requestrr"]

################################
# Paths
Expand All @@ -29,16 +29,15 @@ requestrr_paths_folders_list:
requestrr_web_subdomain: "{{ requestrr_name }}"
requestrr_web_domain: "{{ user.domain }}"
requestrr_web_port: "4545"
requestrr_web_url: "{{ 'https://' + (requestrr_web_subdomain + '.' + requestrr_web_domain
if (requestrr_web_subdomain | length > 0)
else requestrr_web_domain) }}"
requestrr_web_url: "{{ 'https://' + lookup('vars', requestrr_name + '_web_subdomain', default=requestrr_web_subdomain)
+ '.' + lookup('vars', requestrr_name + '_web_domain', default=requestrr_web_domain) }}"

################################
# DNS
################################

requestrr_dns_record: "{{ requestrr_web_subdomain }}"
requestrr_dns_zone: "{{ requestrr_web_domain }}"
requestrr_dns_record: "{{ lookup('vars', requestrr_name + '_web_subdomain', default=requestrr_web_subdomain) }}"
requestrr_dns_zone: "{{ lookup('vars', requestrr_name + '_web_domain', default=requestrr_web_domain) }}"
requestrr_dns_proxy: "{{ dns.proxied }}"

################################
Expand All @@ -62,14 +61,16 @@ requestrr_docker_container: "{{ requestrr_name }}"

# Image
requestrr_docker_image_pull: true
requestrr_docker_image_repo: "saltydk/requestrr"
requestrr_docker_image_tag: "latest"
requestrr_docker_image: "saltydk/requestrr:{{ requestrr_docker_image_tag }}"
requestrr_docker_image: "{{ lookup('vars', requestrr_name + '_docker_image_repo', default=requestrr_docker_image_repo)
+ ':' + lookup('vars', requestrr_name + '_docker_image_tag', default=requestrr_docker_image_tag) }}"

# Ports
requestrr_docker_ports_defaults: []
requestrr_docker_ports_custom: []
requestrr_docker_ports: "{{ requestrr_docker_ports_defaults
+ requestrr_docker_ports_custom }}"
requestrr_docker_ports: "{{ lookup('vars', requestrr_name + '_docker_ports_defaults', default=requestrr_docker_ports_defaults)
+ lookup('vars', requestrr_name + '_docker_ports_custom', default=requestrr_docker_ports_custom) }}"

# Envs
requestrr_docker_envs_default:
Expand All @@ -78,41 +79,41 @@ requestrr_docker_envs_default:
PGID: "{{ gid }}"
UMASK: "002"
requestrr_docker_envs_custom: {}
requestrr_docker_envs: "{{ requestrr_docker_envs_default
| combine(requestrr_docker_envs_custom) }}"
requestrr_docker_envs: "{{ lookup('vars', requestrr_name + '_docker_envs_default', default=requestrr_docker_envs_default)
| combine(lookup('vars', requestrr_name + '_docker_envs_custom', default=requestrr_docker_envs_custom)) }}"

# Commands
requestrr_docker_commands_default: []
requestrr_docker_commands_custom: []
requestrr_docker_commands: "{{ requestrr_docker_commands_default
+ requestrr_docker_commands_custom }}"
requestrr_docker_commands: "{{ lookup('vars', requestrr_name + '_docker_commands_default', default=requestrr_docker_commands_default)
+ lookup('vars', requestrr_name + '_docker_commands_custom', default=requestrr_docker_commands_custom) }}"

# Volumes
requestrr_docker_volumes_default:
- "{{ requestrr_paths_location }}:/config"
requestrr_docker_volumes_custom: []
requestrr_docker_volumes: "{{ requestrr_docker_volumes_default
+ requestrr_docker_volumes_custom }}"
requestrr_docker_volumes: "{{ lookup('vars', requestrr_name + '_docker_volumes_default', default=requestrr_docker_volumes_default)
+ lookup('vars', requestrr_name + '_docker_volumes_custom', default=requestrr_docker_volumes_custom) }}"

# Devices
requestrr_docker_devices_default: []
requestrr_docker_devices_custom: []
requestrr_docker_devices: "{{ requestrr_docker_devices_default
+ requestrr_docker_devices_custom }}"
requestrr_docker_devices: "{{ lookup('vars', requestrr_name + '_docker_devices_default', default=requestrr_docker_devices_default)
+ lookup('vars', requestrr_name + '_docker_devices_custom', default=requestrr_docker_devices_custom) }}"

# Hosts
requestrr_docker_hosts_default: []
requestrr_docker_hosts_custom: []
requestrr_docker_hosts: "{{ docker_hosts_common
| combine(requestrr_docker_hosts_default)
| combine(requestrr_docker_hosts_custom) }}"
| combine(lookup('vars', requestrr_name + '_docker_hosts_default', default=requestrr_docker_hosts_default))
| combine(lookup('vars', requestrr_name + '_docker_hosts_custom', default=requestrr_docker_hosts_custom)) }}"

# Labels
requestrr_docker_labels_default: {}
requestrr_docker_labels_custom: {}
requestrr_docker_labels: "{{ docker_labels_common
| combine(requestrr_docker_labels_default)
| combine(requestrr_docker_labels_custom) }}"
| combine(lookup('vars', requestrr_name + '_docker_labels_default', default=requestrr_docker_labels_default))
| combine(lookup('vars', requestrr_name + '_docker_labels_custom', default=requestrr_docker_labels_custom)) }}"

# Hostname
requestrr_docker_hostname: "{{ requestrr_name }}"
Expand All @@ -122,20 +123,20 @@ requestrr_docker_networks_alias: "{{ requestrr_name }}"
requestrr_docker_networks_default: []
requestrr_docker_networks_custom: []
requestrr_docker_networks: "{{ docker_networks_common
+ requestrr_docker_networks_default
+ requestrr_docker_networks_custom }}"
+ lookup('vars', requestrr_name + '_docker_networks_default', default=requestrr_docker_networks_default)
+ lookup('vars', requestrr_name + '_docker_networks_custom', default=requestrr_docker_networks_custom) }}"

# Capabilities
requestrr_docker_capabilities_default: []
requestrr_docker_capabilities_custom: []
requestrr_docker_capabilities: "{{ requestrr_docker_capabilities_default
+ requestrr_docker_capabilities_custom }}"
requestrr_docker_capabilities: "{{ lookup('vars', requestrr_name + '_docker_capabilities_default', default=requestrr_docker_capabilities_default)
+ lookup('vars', requestrr_name + '_docker_capabilities_custom', default=requestrr_docker_capabilities_custom) }}"

# Security Opts
requestrr_docker_security_opts_default: []
requestrr_docker_security_opts_custom: []
requestrr_docker_security_opts: "{{ requestrr_docker_security_opts_default
+ requestrr_docker_security_opts_custom }}"
requestrr_docker_security_opts: "{{ lookup('vars', requestrr_name + '_docker_security_opts_default', default=requestrr_docker_security_opts_default)
+ lookup('vars', requestrr_name + '_docker_security_opts_custom', default=requestrr_docker_security_opts_custom) }}"

# Restart Policy
requestrr_docker_restart_policy: unless-stopped
Expand Down
20 changes: 6 additions & 14 deletions roles/requestrr/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
# GNU General Public License v3.0 #
#########################################################################
---
- name: Add DNS record
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml"
- name: "Execute Requestrr roles"
ansible.builtin.include_tasks: main2.yml
vars:
dns_record: "{{ lookup('vars', role_name + '_dns_record') }}"
dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}"
dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}"

- name: Remove existing Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"

- name: Create directories
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml"

- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"
requestrr_name: "{{ role }}"
with_items: "{{ requestrr_instances }}"
loop_control:
loop_var: role
24 changes: 24 additions & 0 deletions roles/requestrr/tasks/main2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#########################################################################
# Title: Sandbox: Requestrr #
# Author(s): nostyle, TABLE272 #
# URL: https://github.com/saltyorg/Sandbox #
# -- #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
---
- name: Add DNS record
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml"
vars:
dns_record: "{{ lookup('vars', role_name + '_dns_record') }}"
dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}"
dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}"

- name: Remove existing Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"

- name: Create directories
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml"

- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"
17 changes: 0 additions & 17 deletions roles/requestrrx/tasks/main.yml

This file was deleted.

59 changes: 30 additions & 29 deletions roles/rflood/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Basics
################################

rflood_name: rflood
rflood_instances: ["rflood"]

################################
# Paths
Expand All @@ -37,16 +37,15 @@ rflood_paths_rtorrent_rc_location: "{{ rflood_paths_location }}/rtorrent.rc"
rflood_web_subdomain: "{{ rflood_name }}"
rflood_web_domain: "{{ user.domain }}"
rflood_web_port: "3000"
rflood_web_url: "{{ 'https://' + (rflood_web_subdomain + '.' + rflood_web_domain
if (rflood_web_subdomain | length > 0)
else rflood_web_domain) }}"
rflood_web_url: "{{ 'https://' + lookup('vars', rflood_name + '_web_subdomain', default=rflood_web_subdomain)
+ '.' + lookup('vars', rflood_name + '_web_domain', default=rflood_web_domain) }}"

################################
# DNS
################################

rflood_dns_record: "{{ rflood_web_subdomain }}"
rflood_dns_zone: "{{ rflood_web_domain }}"
rflood_dns_record: "{{ lookup('vars', rflood_name + '_web_subdomain', default=rflood_web_subdomain) }}"
rflood_dns_zone: "{{ lookup('vars', rflood_name + '_web_domain', default=rflood_web_domain) }}"
rflood_dns_proxy: "{{ dns.proxied }}"

################################
Expand Down Expand Up @@ -83,8 +82,8 @@ rflood_config_rflood_rc_settings_default:
# Maximum XMLRPC payloads
- { option: "network.xmlrpc.size_limit.set", value: "20M" }
rflood_config_rflood_rc_settings_custom: []
rflood_config_rflood_rc_settings_list: "{{ rflood_config_rflood_rc_settings_default
+ rflood_config_rflood_rc_settings_custom }}"
rflood_config_rflood_rc_settings_list: "{{ lookup('vars', rflood_name + '_config_rflood_rc_settings_default', default=rflood_config_rflood_rc_settings_default)
+ lookup('vars', rflood_name + '_config_rflood_rc_settings_custom', default=rflood_config_rflood_rc_settings_custom) }}"

################################
# Docker
Expand All @@ -95,8 +94,10 @@ rflood_docker_container: "{{ rflood_name }}"

# Image
rflood_docker_image_pull: true
rflood_docker_image_repo: "ghcr.io/hotio/rflood"
rflood_docker_image_tag: "release"
rflood_docker_image: "ghcr.io/hotio/rflood:{{ rflood_docker_image_tag }}"
rflood_docker_image: "{{ lookup('vars', rflood_name + '_docker_image_repo', default=rflood_docker_image_repo)
+ ':' + lookup('vars', rflood_name + '_docker_image_tag', default=rflood_docker_image_tag) }}"

# Ports
# - Internal and External ports need to match for the next set of ports
Expand All @@ -111,8 +112,8 @@ rflood_docker_ports_defaults:
- "{{ rflood_docker_ports_50000 }}:{{ rflood_docker_ports_50000 }}"
- "{{ rflood_docker_ports_6881 }}:{{ rflood_docker_ports_6881 }}/udp"
rflood_docker_ports_custom: []
rflood_docker_ports: "{{ rflood_docker_ports_defaults
+ rflood_docker_ports_custom }}"
rflood_docker_ports: "{{ lookup('vars', rflood_name + '_docker_ports_defaults', default=rflood_docker_ports_defaults)
+ lookup('vars', rflood_name + '_docker_ports_custom', default=rflood_docker_ports_custom) }}"

# Envs
rflood_docker_envs_default:
Expand All @@ -122,42 +123,42 @@ rflood_docker_envs_default:
UMASK: "002"
FLOOD_AUTH: "false"
rflood_docker_envs_custom: {}
rflood_docker_envs: "{{ rflood_docker_envs_default
| combine(rflood_docker_envs_custom) }}"
rflood_docker_envs: "{{ lookup('vars', rflood_name + '_docker_envs_default', default=rflood_docker_envs_default)
| combine(lookup('vars', rflood_name + '_docker_envs_custom', default=rflood_docker_envs_custom)) }}"

# Commands
rflood_docker_commands_default: []
rflood_docker_commands_custom: []
rflood_docker_commands: "{{ rflood_docker_commands_default
+ rflood_docker_commands_custom }}"
rflood_docker_commands: "{{ lookup('vars', rflood_name + '_docker_commands_default', default=rflood_docker_commands_default)
+ lookup('vars', rflood_name + '_docker_commands_custom', default=rflood_docker_commands_custom) }}"

# Volumes
rflood_docker_volumes_default:
- "{{ rflood_paths_location }}:/config"
- "{{ server_appdata_path }}/scripts:/scripts"
rflood_docker_volumes_custom: []
rflood_docker_volumes: "{{ rflood_docker_volumes_default
+ rflood_docker_volumes_custom }}"
rflood_docker_volumes: "{{ lookup('vars', rflood_name + '_docker_volumes_default', default=rflood_docker_volumes_default)
+ lookup('vars', rflood_name + '_docker_volumes_custom', default=rflood_docker_volumes_custom) }}"

# Devices
rflood_docker_devices_default: []
rflood_docker_devices_custom: []
rflood_docker_devices: "{{ rflood_docker_devices_default
+ rflood_docker_devices_custom }}"
rflood_docker_devices: "{{ lookup('vars', rflood_name + '_docker_devices_default', default=rflood_docker_devices_default)
+ lookup('vars', rflood_name + '_docker_devices_custom', default=rflood_docker_devices_custom) }}"

# Hosts
rflood_docker_hosts_default: []
rflood_docker_hosts_custom: []
rflood_docker_hosts: "{{ docker_hosts_common
| combine(rflood_docker_hosts_default)
| combine(rflood_docker_hosts_custom) }}"
| combine(lookup('vars', rflood_name + '_docker_hosts_default', default=rflood_docker_hosts_default))
| combine(lookup('vars', rflood_name + '_docker_hosts_custom', default=rflood_docker_hosts_custom)) }}"

# Labels
rflood_docker_labels_default: {}
rflood_docker_labels_custom: {}
rflood_docker_labels: "{{ docker_labels_common
| combine(rflood_docker_labels_default)
| combine(rflood_docker_labels_custom) }}"
| combine(lookup('vars', rflood_name + '_docker_labels_default', default=rflood_docker_labels_default))
| combine(lookup('vars', rflood_name + '_docker_labels_custom', default=rflood_docker_labels_custom)) }}"

# Hostname
rflood_docker_hostname: "{{ rflood_name }}"
Expand All @@ -167,20 +168,20 @@ rflood_docker_networks_alias: "{{ rflood_name }}"
rflood_docker_networks_default: []
rflood_docker_networks_custom: []
rflood_docker_networks: "{{ docker_networks_common
+ rflood_docker_networks_default
+ rflood_docker_networks_custom }}"
+ lookup('vars', rflood_name + '_docker_networks_default', default=rflood_docker_networks_default)
+ lookup('vars', rflood_name + '_docker_networks_custom', default=rflood_docker_networks_custom) }}"

# Capabilities
rflood_docker_capabilities_default: []
rflood_docker_capabilities_custom: []
rflood_docker_capabilities: "{{ rflood_docker_capabilities_default
+ rflood_docker_capabilities_custom }}"
rflood_docker_capabilities: "{{ lookup('vars', rflood_name + '_docker_capabilities_default', default=rflood_docker_capabilities_default)
+ lookup('vars', rflood_name + '_docker_capabilities_custom', default=rflood_docker_capabilities_custom) }}"

# Security Opts
rflood_docker_security_opts_default: []
rflood_docker_security_opts_custom: []
rflood_docker_security_opts: "{{ rflood_docker_security_opts_default
+ rflood_docker_security_opts_custom }}"
rflood_docker_security_opts: "{{ lookup('vars', rflood_name + '_docker_security_opts_default', default=rflood_docker_security_opts_default)
+ lookup('vars', rflood_name + '_docker_security_opts_custom', default=rflood_docker_security_opts_custom) }}"

# Restart Policy
rflood_docker_restart_policy: unless-stopped
Expand Down
26 changes: 6 additions & 20 deletions roles/rflood/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,10 @@
# GNU General Public License v3.0 #
#########################################################################
---
- name: Add DNS record
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml"
- name: "Execute rflood roles"
ansible.builtin.include_tasks: main2.yml
vars:
dns_record: "{{ lookup('vars', role_name + '_dns_record') }}"
dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}"
dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}"

- name: Remove existing Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml"

- name: Create directories
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml"

- name: Pre-Install Tasks
ansible.builtin.import_tasks: "subtasks/pre-install/main.yml"

- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"

- name: Post-Install Tasks
ansible.builtin.import_tasks: "subtasks/post-install/main.yml"
rflood_name: "{{ role }}"
with_items: "{{ rflood_instances }}"
loop_control:
loop_var: role
Loading
Loading