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

feat(role): add aria2 + webui (close #2) #158

Merged
merged 1 commit into from
Nov 7, 2022
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
169 changes: 169 additions & 0 deletions roles/aria2_ng/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions roles/aria2_ng/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }
Expand Down