From 28fa2ca95d5a5769c0cce767bb6139e8dcb5fd0d Mon Sep 17 00:00:00 2001 From: owine Date: Tue, 7 Jan 2025 09:10:05 -0600 Subject: [PATCH] Autobrr: New role Omegabrr: Deprecate (functionality built into autobrr) --- roles/autobrr/defaults/main.yml | 145 +++++++++++++++++++++ roles/{omegabrr => autobrr}/tasks/main.yml | 32 +---- roles/omegabrr/defaults/main.yml | 145 --------------------- roles/omegabrr/templates/config.yaml.j2 | 31 ----- sandbox.yml | 2 +- 5 files changed, 148 insertions(+), 207 deletions(-) create mode 100644 roles/autobrr/defaults/main.yml rename roles/{omegabrr => autobrr}/tasks/main.yml (50%) delete mode 100644 roles/omegabrr/defaults/main.yml delete mode 100644 roles/omegabrr/templates/config.yaml.j2 diff --git a/roles/autobrr/defaults/main.yml b/roles/autobrr/defaults/main.yml new file mode 100644 index 0000000000..2704533c65 --- /dev/null +++ b/roles/autobrr/defaults/main.yml @@ -0,0 +1,145 @@ +####################################################################### +# Title: Sandbox: Autobrr | Default Variables # +# Author(s): owine # +# URL: https://github.com/saltyorg/Sandbox # +# -- # +####################################################################### +# GNU General Public License v3.0 # +####################################################################### +--- +################################ +# Basics +################################ + +autobrr_name: autobrr + +################################ +# Paths +################################ + +autobrr_paths_folder: "{{ autobrr_name }}" +autobrr_paths_location: "{{ server_appdata_path }}/{{ autobrr_paths_folder }}" +autobrr_paths_config_location: "{{ autobrr_paths_location }}/config.yaml" +autobrr_paths_folders_list: + - "{{ autobrr_paths_location }}" + +################################ +# Web +################################ + +autobrr_web_subdomain: "{{ autobrr_name }}" +autobrr_web_domain: "{{ user.domain }}" +autobrr_web_port: "7474" +autobrr_web_url: "{{ 'https://' + (autobrr_web_subdomain + '.' + autobrr_web_domain + if (autobrr_web_subdomain | length > 0) + else autobrr_web_domain) }}" + +################################ +# DNS +################################ + +autobrr_dns_record: "{{ autobrr_web_subdomain }}" +autobrr_dns_zone: "{{ autobrr_web_domain }}" +autobrr_dns_proxy: "{{ dns.proxied }}" + +################################ +# Traefik +################################ + +autobrr_traefik_sso_middleware: "{{ traefik_default_sso_middleware }}" +autobrr_traefik_middleware_default: "{{ traefik_default_middleware }}" +autobrr_traefik_middleware_custom: "" +autobrr_traefik_certresolver: "{{ traefik_default_certresolver }}" +autobrr_traefik_enabled: true +autobrr_traefik_api_enabled: true +autobrr_traefik_api_endpoint: "PathPrefix(`/api`)" + +################################ +# Docker +################################ + +# Container +autobrr_docker_container: "{{ autobrr_name }}" + +# Image +autobrr_docker_image_pull: true +autobrr_docker_image_tag: "latest" +autobrr_docker_image: "ghcr.io/autobrr/autobrr:{{ autobrr_docker_image_tag }}" + +# Ports +autobrr_docker_ports_defaults: [] +autobrr_docker_ports_custom: [] +autobrr_docker_ports: "{{ autobrr_docker_ports_defaults + + autobrr_docker_ports_custom }}" + +# Envs +autobrr_docker_envs_default: + TZ: "{{ tz }}" +autobrr_docker_envs_custom: {} +autobrr_docker_envs: "{{ autobrr_docker_envs_default + | combine(autobrr_docker_envs_custom) }}" + +# Commands +autobrr_docker_commands_default: [] +autobrr_docker_commands_custom: [] +autobrr_docker_commands: "{{ autobrr_docker_commands_default + + autobrr_docker_commands_custom }}" + +# Volumes +autobrr_docker_volumes_default: + - "{{ autobrr_paths_location }}:/config" +autobrr_docker_volumes_custom: [] +autobrr_docker_volumes: "{{ autobrr_docker_volumes_default + + autobrr_docker_volumes_custom }}" + +# Devices +autobrr_docker_devices_default: [] +autobrr_docker_devices_custom: [] +autobrr_docker_devices: "{{ autobrr_docker_devices_default + + autobrr_docker_devices_custom }}" + +# Hosts +autobrr_docker_hosts_default: {} +autobrr_docker_hosts_custom: {} +autobrr_docker_hosts: "{{ docker_hosts_common + | combine(autobrr_docker_hosts_default) + | combine(autobrr_docker_hosts_custom) }}" + +# Labels +autobrr_docker_labels_default: {} +autobrr_docker_labels_custom: {} +autobrr_docker_labels: "{{ docker_labels_common + | combine(autobrr_docker_labels_default) + | combine(autobrr_docker_labels_custom) }}" + +# Hostname +autobrr_docker_hostname: "{{ autobrr_name }}" + +# Networks +autobrr_docker_networks_alias: "{{ autobrr_name }}" +autobrr_docker_networks_default: [] +autobrr_docker_networks_custom: [] +autobrr_docker_networks: "{{ docker_networks_common + + autobrr_docker_networks_default + + autobrr_docker_networks_custom }}" + +# Capabilities +autobrr_docker_capabilities_default: [] +autobrr_docker_capabilities_custom: [] +autobrr_docker_capabilities: "{{ autobrr_docker_capabilities_default + + autobrr_docker_capabilities_custom }}" + +# Security Opts +autobrr_docker_security_opts_default: [] +autobrr_docker_security_opts_custom: [] +autobrr_docker_security_opts: "{{ autobrr_docker_security_opts_default + + autobrr_docker_security_opts_custom }}" + +# Restart Policy +autobrr_docker_restart_policy: unless-stopped + +# State +autobrr_docker_state: started + +# User +autobrr_docker_user: "{{ uid }}:{{ gid }}" diff --git a/roles/omegabrr/tasks/main.yml b/roles/autobrr/tasks/main.yml similarity index 50% rename from roles/omegabrr/tasks/main.yml rename to roles/autobrr/tasks/main.yml index 4cd63887ac..9c710fe4f7 100644 --- a/roles/omegabrr/tasks/main.yml +++ b/roles/autobrr/tasks/main.yml @@ -1,6 +1,6 @@ ####################################################################### -# Title: Sandbox: Omegabrr | Tasks # -# Author(s): keldian # +# Title: Sandbox: Autobrr | Tasks # +# Author(s): owine # # URL: https://github.com/saltyorg/Sandbox # # -- # ####################################################################### @@ -20,33 +20,5 @@ - name: Create directories ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml" -- name: Check if `{{ omegabrr_paths_config_location | basename }}` exists - ansible.builtin.stat: - path: "{{ omegabrr_paths_config_location }}" - register: omegabrr_config - -- name: New `{{ omegabrr_paths_config_location | basename }}` tasks - when: not omegabrr_config.stat.exists - block: - - name: Get Instance Info - ansible.builtin.include_tasks: "{{ resources_tasks_path }}/instances/get_info.yml" - vars: - get_info_list: - - sonarr - - radarr - - - name: Generate API token - ansible.builtin.set_fact: - omegabrr_apitoken: "{{ lookup('community.general.random_string', override_all='0123456789abcdef', length=32) }}" - - - name: Import default `{{ omegabrr_paths_config_location | basename }}` - ansible.builtin.template: - src: config.yaml.j2 - dest: "{{ omegabrr_paths_config_location }}" - owner: "{{ user.name }}" - group: "{{ user.name }}" - mode: "0664" - force: yes - - name: Create Docker container ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml" diff --git a/roles/omegabrr/defaults/main.yml b/roles/omegabrr/defaults/main.yml deleted file mode 100644 index 6ff31abcb1..0000000000 --- a/roles/omegabrr/defaults/main.yml +++ /dev/null @@ -1,145 +0,0 @@ -####################################################################### -# Title: Sandbox: Omegabrr | Default Variables # -# Author(s): keldian # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -####################################################################### -# GNU General Public License v3.0 # -####################################################################### ---- -################################ -# Basics -################################ - -omegabrr_name: omegabrr - -################################ -# Paths -################################ - -omegabrr_paths_folder: "{{ omegabrr_name }}" -omegabrr_paths_location: "{{ server_appdata_path }}/{{ omegabrr_paths_folder }}" -omegabrr_paths_config_location: "{{ omegabrr_paths_location }}/config.yaml" -omegabrr_paths_folders_list: - - "{{ omegabrr_paths_location }}" - -################################ -# Web -################################ - -omegabrr_web_subdomain: "{{ omegabrr_name }}" -omegabrr_web_domain: "{{ user.domain }}" -omegabrr_web_port: "7441" -omegabrr_web_url: "{{ 'https://' + (omegabrr_web_subdomain + '.' + omegabrr_web_domain - if (omegabrr_web_subdomain | length > 0) - else omegabrr_web_domain) }}" - -################################ -# DNS -################################ - -omegabrr_dns_record: "{{ omegabrr_web_subdomain }}" -omegabrr_dns_zone: "{{ omegabrr_web_domain }}" -omegabrr_dns_proxy: "{{ dns.proxied }}" - -################################ -# Traefik -################################ - -omegabrr_traefik_sso_middleware: "" -omegabrr_traefik_middleware_default: "{{ traefik_default_middleware }}" -omegabrr_traefik_middleware_custom: "" -omegabrr_traefik_certresolver: "{{ traefik_default_certresolver }}" -omegabrr_traefik_enabled: true -omegabrr_traefik_api_enabled: false -omegabrr_traefik_api_endpoint: "" - -################################ -# Docker -################################ - -# Container -omegabrr_docker_container: "{{ omegabrr_name }}" - -# Image -omegabrr_docker_image_pull: true -omegabrr_docker_image_tag: "latest" -omegabrr_docker_image: "ghcr.io/autobrr/omegabrr:{{ omegabrr_docker_image_tag }}" - -# Ports -omegabrr_docker_ports_defaults: [] -omegabrr_docker_ports_custom: [] -omegabrr_docker_ports: "{{ omegabrr_docker_ports_defaults - + omegabrr_docker_ports_custom }}" - -# Envs -omegabrr_docker_envs_default: - TZ: "{{ tz }}" -omegabrr_docker_envs_custom: {} -omegabrr_docker_envs: "{{ omegabrr_docker_envs_default - | combine(omegabrr_docker_envs_custom) }}" - -# Commands -omegabrr_docker_commands_default: [] -omegabrr_docker_commands_custom: [] -omegabrr_docker_commands: "{{ omegabrr_docker_commands_default - + omegabrr_docker_commands_custom }}" - -# Volumes -omegabrr_docker_volumes_default: - - "{{ omegabrr_paths_location }}:/config" -omegabrr_docker_volumes_custom: [] -omegabrr_docker_volumes: "{{ omegabrr_docker_volumes_default - + omegabrr_docker_volumes_custom }}" - -# Devices -omegabrr_docker_devices_default: [] -omegabrr_docker_devices_custom: [] -omegabrr_docker_devices: "{{ omegabrr_docker_devices_default - + omegabrr_docker_devices_custom }}" - -# Hosts -omegabrr_docker_hosts_default: {} -omegabrr_docker_hosts_custom: {} -omegabrr_docker_hosts: "{{ docker_hosts_common - | combine(omegabrr_docker_hosts_default) - | combine(omegabrr_docker_hosts_custom) }}" - -# Labels -omegabrr_docker_labels_default: {} -omegabrr_docker_labels_custom: {} -omegabrr_docker_labels: "{{ docker_labels_common - | combine(omegabrr_docker_labels_default) - | combine(omegabrr_docker_labels_custom) }}" - -# Hostname -omegabrr_docker_hostname: "{{ omegabrr_name }}" - -# Networks -omegabrr_docker_networks_alias: "{{ omegabrr_name }}" -omegabrr_docker_networks_default: [] -omegabrr_docker_networks_custom: [] -omegabrr_docker_networks: "{{ docker_networks_common - + omegabrr_docker_networks_default - + omegabrr_docker_networks_custom }}" - -# Capabilities -omegabrr_docker_capabilities_default: [] -omegabrr_docker_capabilities_custom: [] -omegabrr_docker_capabilities: "{{ omegabrr_docker_capabilities_default - + omegabrr_docker_capabilities_custom }}" - -# Security Opts -omegabrr_docker_security_opts_default: [] -omegabrr_docker_security_opts_custom: [] -omegabrr_docker_security_opts: "{{ omegabrr_docker_security_opts_default - + omegabrr_docker_security_opts_custom }}" - -# Restart Policy -omegabrr_docker_restart_policy: unless-stopped - -# State -omegabrr_docker_state: started - -# User -omegabrr_docker_user: "{{ uid }}:{{ gid }}" diff --git a/roles/omegabrr/templates/config.yaml.j2 b/roles/omegabrr/templates/config.yaml.j2 deleted file mode 100644 index 1f1472308d..0000000000 --- a/roles/omegabrr/templates/config.yaml.j2 +++ /dev/null @@ -1,31 +0,0 @@ -# config.toml ---- -server: - host: 0.0.0.0 - port: 7441 - apiToken: {{ omegabrr_apitoken }} -schedule: "0 */6 * * *" # every 6th hour -clients: - autobrr: - host: {{ 'http://' + autobrr_docker_networks_alias + ':' + autobrr_web_port }} - apikey: API_KEY - -{%+ if True %} arr:{% endif %} -{% for instance in radarr_info +%} -{% if radarr_info[instance]['api_key'] != 'not installed' %} - - name: {{ radarr_info[instance]['name'] }} - type: radarr - host: {{ 'http://' + radarr_info[instance]['name'] + ':' + radarr_web_port }} - apikey: {{ radarr_info[instance]['api_key'] }} - filters: [] -{% endif %} -{%- endfor %} -{% for instance in sonarr_info +%} -{% if sonarr_info[instance]['api_key'] != 'not installed' %} - - name: {{ sonarr_info[instance]['name'] }} - type: sonarr - host: {{ 'http://' + sonarr_info[instance]['name'] + ':' + sonarr_web_port }} - apikey: {{ sonarr_info[instance]['api_key'] }} - filters: [] -{% endif %} -{%- endfor %} \ No newline at end of file diff --git a/sandbox.yml b/sandbox.yml index 2f6d786d70..63ea05c603 100644 --- a/sandbox.yml +++ b/sandbox.yml @@ -28,6 +28,7 @@ - { role: archivebox, tags: ['archivebox'] } - { role: aria2_ng, tags: ['aria2-ng'] } - { role: audiobookshelf, tags: ['audiobookshelf'] } + - { role: autobrr, tags: ['autobrr'] } - { role: barcodebuddy, tags: ['barcodebuddy'] } - { role: beets, tags: ['beets'] } - { role: booksonic, tags: ['booksonic'] } @@ -124,7 +125,6 @@ - { role: notifiarr, tags: ['notifiarr'] } - { role: olivetin, tags: ['olivetin'] } - { role: ombi, tags: ['ombi'] } - - { role: omegabrr, tags: ['omegabrr'] } - { role: openobserve, tags: ['openobserve'] } - { role: paperless_ngx, tags: ['paperless-ngx'] } - { role: pgadmin, tags: ['pgadmin'] }