diff --git a/roles/aria2_ng/defaults/main.yml b/roles/aria2_ng/defaults/main.yml new file mode 100644 index 0000000000..73e8b0fe61 --- /dev/null +++ b/roles/aria2_ng/defaults/main.yml @@ -0,0 +1,169 @@ +########################################################################## +# Title: Sandbox: Aria2 + AriaNG webui | Default Variables # +# Author(s): JigSawFr # +# URL: https://github.com/saltyorg/Sandbox # +# -- # +########################################################################## +# GNU General Public License v3.0 # +########################################################################## +--- +################################ +# Basics +################################ + +aria2_ng_name: aria + +################################ +# Paths +################################ + +aria2_ng_paths_folder: "{{ aria2_ng_name }}" +aria2_ng_paths_location: "{{ server_appdata_path }}/{{ aria2_ng_paths_folder }}" +aria2_ng_paths_downloads_location: "{{ downloads_root_path }}/{{ aria2_ng_paths_folder }}" +aria2_ng_paths_folders_list: + - "{{ aria2_ng_paths_location }}" + - "{{ aria2_ng_paths_downloads_location }}" + +################################ +# Web +################################ + +aria2_ng_web_subdomain: "{{ aria2_ng_name }}" +aria2_ng_web_domain: "{{ user.domain }}" +aria2_ng_web_port: "8080" +aria2_ng_web_url: "{{ 'https://' + aria2_ng_web_subdomain + '.' + aria2_ng_web_domain + if (reverse_proxy_is_enabled) + else 'http://localhost:' + aria2_ng_web_port }}" + +################################ +# DNS +################################ + +aria2_ng_dns_record: "{{ aria2_ng_web_subdomain }}" +aria2_ng_dns_zone: "{{ aria2_ng_web_domain }}" +aria2_ng_dns_proxy: "{{ dns.proxied }}" + +################################ +# Traefik +################################ + +aria2_ng_traefik_sso_middleware: "{{ traefik_default_sso_middleware }}" +aria2_ng_traefik_middleware_default: "{{ traefik_default_middleware + ',' + + lookup('vars', aria2_ng_name + '_traefik_sso_middleware', default=aria2_ng_traefik_sso_middleware) + if (lookup('vars', aria2_ng_name + '_traefik_sso_middleware', default=aria2_ng_traefik_sso_middleware) | length > 0) + else traefik_default_middleware }}" +aria2_ng_traefik_middleware_custom: "" +aria2_ng_traefik_middleware: "{{ aria2_ng_traefik_middleware_default + ',' + + aria2_ng_traefik_middleware_custom + if (not aria2_ng_traefik_middleware_custom.startswith(',') and aria2_ng_traefik_middleware_custom | length > 0) + else aria2_ng_traefik_middleware_default + + aria2_ng_traefik_middleware_custom }}" +aria2_ng_traefik_certresolver: "{{ traefik_default_certresolver }}" +aria2_ng_traefik_enabled: true +# Insecure until we have a way to generate an app token +aria2_ng_traefik_api_enabled: false +aria2_ng_traefik_api_endpoint: "`/jsonrpc`" + +################################ +# Docker +################################ + +# Container +aria2_ng_docker_container: "{{ aria2_ng_name }}" + +# Image +aria2_ng_docker_image_pull: true +aria2_ng_docker_image_tag: "latest" +aria2_ng_docker_image: "hurlenko/aria2-ariang:{{ aria2_ng_docker_image_tag }}" + +# Healthcheck +aria2_ng_docker_healthcheck: + test: ["CMD", "curl", "--fail", "http://localhost:8080"] + interval: 10s + timeout: 5s + retries: 10 + start_period: 10s + +# Ports +aria2_ng_docker_ports_defaults: + - "{{ aria2_ng_web_port }}" +aria2_ng_docker_ports_custom: [] +aria2_ng_docker_ports: "{{ aria2_ng_docker_ports_defaults + + aria2_ng_docker_ports_custom + if (not reverse_proxy_is_enabled) + else aria2_ng_docker_ports_custom }}" + +# Envs +aria2_ng_docker_envs_default: + TZ: "{{ tz }}" + PUID: "{{ uid }}" + PGID: "{{ gid }}" + # RPC_SECRET: "{{ aria2_ng_secret_key.stdout }}" + # EMBED_RPC_SECRET: "true" + ARIA2RPCPORT: "443" +aria2_ng_docker_envs_custom: {} +aria2_ng_docker_envs: "{{ aria2_ng_docker_envs_default + | combine(aria2_ng_docker_envs_custom) }}" + +# Commands +aria2_ng_docker_commands_default: [] +aria2_ng_docker_commands_custom: [] +aria2_ng_docker_commands: "{{ aria2_ng_docker_commands_default + + aria2_ng_docker_commands_custom }}" + +# Volumes +aria2_ng_docker_volumes_default: + - "{{ aria2_ng_paths_location }}:/aria2/conf" + - "{{ aria2_ng_paths_downloads_location }}:/aria2/data" +aria2_ng_docker_volumes_custom: [] +aria2_ng_docker_volumes: "{{ aria2_ng_docker_volumes_default + + aria2_ng_docker_volumes_custom }}" + +# Devices +aria2_ng_docker_devices_default: [] +aria2_ng_docker_devices_custom: [] +aria2_ng_docker_devices: "{{ aria2_ng_docker_devices_default + + aria2_ng_docker_devices_custom }}" + +# Hosts +aria2_ng_docker_hosts_default: [] +aria2_ng_docker_hosts_custom: [] +aria2_ng_docker_hosts: "{{ docker_hosts_common + | combine(aria2_ng_docker_hosts_default) + | combine(aria2_ng_docker_hosts_custom) }}" + +# Labels +aria2_ng_docker_labels_default: {} +aria2_ng_docker_labels_custom: {} +aria2_ng_docker_labels: "{{ docker_labels_common + | combine(aria2_ng_docker_labels_default) + | combine(aria2_ng_docker_labels_custom) }}" + +# Hostname +aria2_ng_docker_hostname: "{{ aria2_ng_name }}" + +# Networks +aria2_ng_docker_networks_alias: "{{ aria2_ng_name }}" +aria2_ng_docker_networks_default: [] +aria2_ng_docker_networks_custom: [] +aria2_ng_docker_networks: "{{ docker_networks_common + + aria2_ng_docker_networks_default + + aria2_ng_docker_networks_custom }}" + +# Capabilities +aria2_ng_docker_capabilities_default: [] +aria2_ng_docker_capabilities_custom: [] +aria2_ng_docker_capabilities: "{{ aria2_ng_docker_capabilities_default + + aria2_ng_docker_capabilities_custom }}" + +# Security Opts +aria2_ng_docker_security_opts_default: [] +aria2_ng_docker_security_opts_custom: [] +aria2_ng_docker_security_opts: "{{ aria2_ng_docker_security_opts_default + + aria2_ng_docker_security_opts_custom }}" + +# Restart Policy +aria2_ng_docker_restart_policy: unless-stopped + +# State +aria2_ng_docker_state: started diff --git a/roles/aria2_ng/tasks/main.yml b/roles/aria2_ng/tasks/main.yml new file mode 100644 index 0000000000..79f5b45e20 --- /dev/null +++ b/roles/aria2_ng/tasks/main.yml @@ -0,0 +1,33 @@ +######################################################################### +# Title: Sandbox: Aria2 + AriaNG webui # +# Author(s): JigSawFr # +# URL: https://github.com/saltyorg/Sandbox # +# -- # +######################################################################### +# GNU General Public License v3.0 # +######################################################################### +# Repository: https://github.com/hurlenko/aria2-ariang-docker +--- +- 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: "Generate Secret Key for RPC" +# ansible.builtin.shell: "openssl rand -hex 20" +# register: aria2_ng_secret_key + +- 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" + +- name: Print Tweaking Info + ansible.builtin.debug: + msg: "For custom docker envs, please visit: https://github.com/hurlenko/aria2-ariang-docker" diff --git a/sandbox.yml b/sandbox.yml index 2450a57fef..10bb48bcb3 100644 --- a/sandbox.yml +++ b/sandbox.yml @@ -22,6 +22,7 @@ - { role: alternatrrx, tags: ['alternatrrx'] } - { role: apprise, tags: ['apprise'] } - { role: archivebox, tags: ['archivebox'] } + - { role: aria2_ng, tags: ['aria2-ng'] } - { role: audiobookshelf, tags: ['audiobookshelf'] } - { role: autobrr, tags: ['autobrr'] } - { role: beets, tags: ['beets'] }