feat: initial sonarr terraform configuration
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
.terraform/
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.backup
|
||||||
|
*.tfplan
|
||||||
|
backend.tf
|
||||||
|
.terragrunt-cache/
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.4.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
types: [yaml]
|
||||||
|
- id: trailing-whitespace
|
||||||
|
types: [yaml]
|
||||||
|
- repo: https://github.com/gruntwork-io/pre-commit
|
||||||
|
rev: v0.1.30
|
||||||
|
hooks:
|
||||||
|
- id: tofu-fmt
|
||||||
|
- id: tofu-validate
|
||||||
|
- id: tflint
|
||||||
|
- id: terragrunt-hcl-fmt
|
||||||
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
|
rev: v1.37.1
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"-d {extends: relaxed, rules: {line-length: disable}, ignore: chart}",
|
||||||
|
"-s",
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: apply
|
||||||
|
image: git.unkin.net/unkin/almalinux9-opentofu:20260606
|
||||||
|
environment:
|
||||||
|
VAULT_AUTH_METHOD: kubernetes
|
||||||
|
commands:
|
||||||
|
- dnf install vault -y
|
||||||
|
- make plan
|
||||||
|
- make apply
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: terraform-sonarr
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 2
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: plan
|
||||||
|
image: git.unkin.net/unkin/almalinux9-opentofu:20260606
|
||||||
|
environment:
|
||||||
|
VAULT_AUTH_METHOD: kubernetes
|
||||||
|
commands:
|
||||||
|
- dnf install vault -y
|
||||||
|
- make plan
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: terraform-sonarr
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 2
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: pre-commit
|
||||||
|
image: git.unkin.net/unkin/almalinux9-opentofu:20260606
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 2
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
.PHONY: init plan apply format
|
||||||
|
|
||||||
|
VAULT_AUTH_METHOD ?= approle
|
||||||
|
VAULT_K8S_ROLE ?= woodpecker_terraform_sonarr
|
||||||
|
VAULT_K8S_MOUNT ?= auth/k8s/au/syd1
|
||||||
|
VAULT_K8S_JWT_PATH ?= /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
|
||||||
|
define vault_env
|
||||||
|
@export VAULT_ADDR="https://vault.service.consul:8200" && \
|
||||||
|
if [ "$(VAULT_AUTH_METHOD)" = "kubernetes" ]; then \
|
||||||
|
export VAULT_TOKEN=$$(vault write -field=token $(VAULT_K8S_MOUNT)/login role=$(VAULT_K8S_ROLE) jwt=$$(cat $(VAULT_K8S_JWT_PATH))); \
|
||||||
|
else \
|
||||||
|
export VAULT_TOKEN=$$(vault write -field=token auth/approle/login role_id=$$VAULT_ROLEID); \
|
||||||
|
fi && \
|
||||||
|
export CONSUL_HTTP_TOKEN=$$(vault read -field=token consul_root/au/syd1/creds/terraform-sonarr) && \
|
||||||
|
export SONARR_API_KEY=$$(vault kv get -field=apitoken kv/service/media-apps/sonarr)
|
||||||
|
endef
|
||||||
|
|
||||||
|
init:
|
||||||
|
@$(call vault_env) && \
|
||||||
|
terragrunt run --all --non-interactive init -- -upgrade
|
||||||
|
|
||||||
|
plan: init
|
||||||
|
@$(call vault_env) && \
|
||||||
|
terragrunt run --all --parallelism 4 --non-interactive plan
|
||||||
|
|
||||||
|
apply: init
|
||||||
|
@$(call vault_env) && \
|
||||||
|
terragrunt run --all --parallelism 2 --non-interactive apply
|
||||||
|
|
||||||
|
format:
|
||||||
|
@echo "Formatting OpenTofu files..."
|
||||||
|
@tofu fmt -recursive .
|
||||||
|
@echo "Formatting Terragrunt files..."
|
||||||
|
@terragrunt hcl fmt
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
locals {
|
||||||
|
config_files = fileset(".", "**/*.yaml")
|
||||||
|
|
||||||
|
all_configs = {
|
||||||
|
for file_path in local.config_files :
|
||||||
|
file_path => yamldecode(file(file_path))
|
||||||
|
}
|
||||||
|
|
||||||
|
config = {
|
||||||
|
custom_formats = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "custom_format/")
|
||||||
|
}
|
||||||
|
quality_profiles = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "quality_profile/")
|
||||||
|
}
|
||||||
|
download_clients = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "download_client/")
|
||||||
|
}
|
||||||
|
indexers = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "indexer/")
|
||||||
|
}
|
||||||
|
notifications = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "notification/")
|
||||||
|
}
|
||||||
|
delay_profiles = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "delay_profile/")
|
||||||
|
}
|
||||||
|
root_folders = {
|
||||||
|
for file_path, content in local.all_configs :
|
||||||
|
trimsuffix(basename(file_path), ".yaml") => content
|
||||||
|
if startswith(file_path, "root_folder/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: av1
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "av1"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: x264
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "(x|h)\\.?264"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: x265
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "(((x|h)\\.?265)|(HEVC))"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: hdr10
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "hdr10"
|
||||||
|
- name: x265
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "(((x|h)\\.?265)|(HEVC))"
|
||||||
|
- name: Surround Sound
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "DTS.?(HD|ES|X(?!\\D))|TRUEHD|ATMOS|DD(\\+|P).?([5-9])|EAC3.?([5-9])"
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: 10bit
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "10bit"
|
||||||
|
- name: hvec
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "hvec"
|
||||||
|
- name: x265
|
||||||
|
implementation: ReleaseTitleSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "(((x|h)\\.?265)|(HEVC))"
|
||||||
|
- name: "release_iVy: iVy"
|
||||||
|
implementation: ReleaseGroupSpecification
|
||||||
|
negate: false
|
||||||
|
required: true
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "-iVy$"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: "AsmoFuscated "
|
||||||
|
implementation: ReleaseGroupSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "AsmoFuscated$"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: d3g
|
||||||
|
implementation: ReleaseGroupSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "d3g$"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: iVy
|
||||||
|
implementation: ReleaseGroupSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "iVy$"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: 1080p
|
||||||
|
implementation: ResolutionSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "1080"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: 2160p
|
||||||
|
implementation: ResolutionSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "2160"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: 720p
|
||||||
|
implementation: ResolutionSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "720"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: size_0_800
|
||||||
|
implementation: SizeSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: min
|
||||||
|
value: "0"
|
||||||
|
- name: max
|
||||||
|
value: "0.8"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: size_1500_3000
|
||||||
|
implementation: SizeSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: min
|
||||||
|
value: "1.5"
|
||||||
|
- name: max
|
||||||
|
value: "3"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: size_3000_6000
|
||||||
|
implementation: SizeSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: min
|
||||||
|
value: "3"
|
||||||
|
- name: max
|
||||||
|
value: "6"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: size_6000_10000
|
||||||
|
implementation: SizeSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: min
|
||||||
|
value: "6"
|
||||||
|
- name: max
|
||||||
|
value: "10"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: size_800_1500
|
||||||
|
implementation: SizeSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: min
|
||||||
|
value: "0.8"
|
||||||
|
- name: max
|
||||||
|
value: "1.5"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: bluray
|
||||||
|
implementation: SourceSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "6"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: hdtv
|
||||||
|
implementation: SourceSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "1"
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
include_custom_format_when_renaming: false
|
||||||
|
specifications:
|
||||||
|
- name: webdl
|
||||||
|
implementation: SourceSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "3"
|
||||||
|
- name: webrip
|
||||||
|
implementation: SourceSpecification
|
||||||
|
negate: false
|
||||||
|
required: false
|
||||||
|
fields:
|
||||||
|
- name: value
|
||||||
|
value: "4"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
enable_usenet: true
|
||||||
|
enable_torrent: true
|
||||||
|
preferred_protocol: usenet
|
||||||
|
usenet_delay: 0
|
||||||
|
torrent_delay: 0
|
||||||
|
bypass_if_highest_quality: true
|
||||||
|
bypass_if_above_custom_format_score: false
|
||||||
|
minimum_custom_format_score: 0
|
||||||
|
tags: []
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
enable: true
|
||||||
|
priority: 1
|
||||||
|
host: nzbget.service.consul
|
||||||
|
port: 443
|
||||||
|
use_ssl: true
|
||||||
|
username: svc_nzbsubmit
|
||||||
|
password: ""
|
||||||
|
tv_category: tvseries
|
||||||
|
remove_completed_downloads: true
|
||||||
|
remove_failed_downloads: true
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
enable_automatic_search: true
|
||||||
|
enable_interactive_search: true
|
||||||
|
enable_rss: true
|
||||||
|
priority: 25
|
||||||
|
base_url: "https://api.nzbgeek.info"
|
||||||
|
api_path: "/api"
|
||||||
|
api_key: ""
|
||||||
|
categories:
|
||||||
|
- 5040
|
||||||
|
- 5045
|
||||||
|
- 5060
|
||||||
|
- 5070
|
||||||
|
- 5080
|
||||||
|
anime_categories: []
|
||||||
|
season_search_maximum_single_episode_age: 0
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
enable_automatic_search: true
|
||||||
|
enable_interactive_search: true
|
||||||
|
enable_rss: true
|
||||||
|
priority: 25
|
||||||
|
base_url: "https://prowlarr.service.consul/1/"
|
||||||
|
api_path: "/api"
|
||||||
|
api_key: ""
|
||||||
|
categories:
|
||||||
|
- 5000
|
||||||
|
- 5020
|
||||||
|
- 5030
|
||||||
|
- 5040
|
||||||
|
- 5045
|
||||||
|
- 5050
|
||||||
|
anime_categories:
|
||||||
|
- 5070
|
||||||
|
season_search_maximum_single_episode_age: 0
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
host: jellyfin.service.consul
|
||||||
|
port: 443
|
||||||
|
use_ssl: true
|
||||||
|
api_key: ""
|
||||||
|
notify: false
|
||||||
|
update_library: true
|
||||||
|
on_grab: true
|
||||||
|
on_download: true
|
||||||
|
on_upgrade: true
|
||||||
|
on_rename: true
|
||||||
|
on_series_add: true
|
||||||
|
on_series_delete: true
|
||||||
|
on_episode_file_delete: true
|
||||||
|
on_episode_file_delete_for_upgrade: true
|
||||||
|
on_application_update: true
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
upgrade_allowed: true
|
||||||
|
cutoff: 7
|
||||||
|
cutoff_format_score: 5000
|
||||||
|
min_format_score: 0
|
||||||
|
quality_groups:
|
||||||
|
- id: 4
|
||||||
|
qualities:
|
||||||
|
- id: 4
|
||||||
|
name: HDTV-720p
|
||||||
|
source: television
|
||||||
|
resolution: 720
|
||||||
|
- id: 9
|
||||||
|
qualities:
|
||||||
|
- id: 9
|
||||||
|
name: HDTV-1080p
|
||||||
|
source: television
|
||||||
|
resolution: 1080
|
||||||
|
- id: 14
|
||||||
|
qualities:
|
||||||
|
- id: 14
|
||||||
|
name: WEBRip-720p
|
||||||
|
source: webRip
|
||||||
|
resolution: 720
|
||||||
|
- id: 5
|
||||||
|
qualities:
|
||||||
|
- id: 5
|
||||||
|
name: WEBDL-720p
|
||||||
|
source: web
|
||||||
|
resolution: 720
|
||||||
|
- id: 6
|
||||||
|
qualities:
|
||||||
|
- id: 6
|
||||||
|
name: Bluray-720p
|
||||||
|
source: bluray
|
||||||
|
resolution: 720
|
||||||
|
- id: 15
|
||||||
|
qualities:
|
||||||
|
- id: 15
|
||||||
|
name: WEBRip-1080p
|
||||||
|
source: webRip
|
||||||
|
resolution: 1080
|
||||||
|
- id: 3
|
||||||
|
qualities:
|
||||||
|
- id: 3
|
||||||
|
name: WEBDL-1080p
|
||||||
|
source: web
|
||||||
|
resolution: 1080
|
||||||
|
- id: 7
|
||||||
|
qualities:
|
||||||
|
- id: 7
|
||||||
|
name: Bluray-1080p
|
||||||
|
source: bluray
|
||||||
|
resolution: 1080
|
||||||
|
format_items:
|
||||||
|
- name: release_AsmoFuscated
|
||||||
|
format: release_AsmoFuscated
|
||||||
|
score: 50
|
||||||
|
- name: release_d3g
|
||||||
|
format: release_d3g
|
||||||
|
score: 50
|
||||||
|
- name: release_iVy
|
||||||
|
format: release_iVy
|
||||||
|
score: 2000
|
||||||
|
- name: format_av1
|
||||||
|
format: format_av1
|
||||||
|
score: -1000
|
||||||
|
- name: size_0_800
|
||||||
|
format: size_0_800
|
||||||
|
score: 50
|
||||||
|
- name: source_hdtv
|
||||||
|
format: source_hdtv
|
||||||
|
score: 50
|
||||||
|
- name: source_webdl
|
||||||
|
format: source_webdl
|
||||||
|
score: 100
|
||||||
|
- name: source_bluray
|
||||||
|
format: source_bluray
|
||||||
|
score: 200
|
||||||
|
- name: size_3000_6000
|
||||||
|
format: size_3000_6000
|
||||||
|
score: 100
|
||||||
|
- name: size_1500_3000
|
||||||
|
format: size_1500_3000
|
||||||
|
score: 200
|
||||||
|
- name: size_800_1500
|
||||||
|
format: size_800_1500
|
||||||
|
score: 600
|
||||||
|
- name: hvec_10bit
|
||||||
|
format: hvec_10bit
|
||||||
|
score: 100
|
||||||
|
- name: resolution_2160p
|
||||||
|
format: resolution_2160p
|
||||||
|
score: -1000
|
||||||
|
- name: resolution_720p
|
||||||
|
format: resolution_720p
|
||||||
|
score: 50
|
||||||
|
- name: resolution_1080p
|
||||||
|
format: resolution_1080p
|
||||||
|
score: 500
|
||||||
|
- name: format_x264
|
||||||
|
format: format_x264
|
||||||
|
score: -500
|
||||||
|
- name: format_x265
|
||||||
|
format: format_x265
|
||||||
|
score: 1000
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
upgrade_allowed: true
|
||||||
|
cutoff: 19
|
||||||
|
cutoff_format_score: 5000
|
||||||
|
min_format_score: 0
|
||||||
|
quality_groups:
|
||||||
|
- id: 4
|
||||||
|
qualities:
|
||||||
|
- id: 4
|
||||||
|
name: HDTV-720p
|
||||||
|
source: television
|
||||||
|
resolution: 720
|
||||||
|
- id: 9
|
||||||
|
qualities:
|
||||||
|
- id: 9
|
||||||
|
name: HDTV-1080p
|
||||||
|
source: television
|
||||||
|
resolution: 1080
|
||||||
|
- id: 14
|
||||||
|
qualities:
|
||||||
|
- id: 14
|
||||||
|
name: WEBRip-720p
|
||||||
|
source: webRip
|
||||||
|
resolution: 720
|
||||||
|
- id: 5
|
||||||
|
qualities:
|
||||||
|
- id: 5
|
||||||
|
name: WEBDL-720p
|
||||||
|
source: web
|
||||||
|
resolution: 720
|
||||||
|
- id: 6
|
||||||
|
qualities:
|
||||||
|
- id: 6
|
||||||
|
name: Bluray-720p
|
||||||
|
source: bluray
|
||||||
|
resolution: 720
|
||||||
|
- id: 15
|
||||||
|
qualities:
|
||||||
|
- id: 15
|
||||||
|
name: WEBRip-1080p
|
||||||
|
source: webRip
|
||||||
|
resolution: 1080
|
||||||
|
- id: 3
|
||||||
|
qualities:
|
||||||
|
- id: 3
|
||||||
|
name: WEBDL-1080p
|
||||||
|
source: web
|
||||||
|
resolution: 1080
|
||||||
|
- id: 7
|
||||||
|
qualities:
|
||||||
|
- id: 7
|
||||||
|
name: Bluray-1080p
|
||||||
|
source: bluray
|
||||||
|
resolution: 1080
|
||||||
|
- id: 16
|
||||||
|
qualities:
|
||||||
|
- id: 16
|
||||||
|
name: HDTV-2160p
|
||||||
|
source: television
|
||||||
|
resolution: 2160
|
||||||
|
- id: 17
|
||||||
|
qualities:
|
||||||
|
- id: 17
|
||||||
|
name: WEBRip-2160p
|
||||||
|
source: webRip
|
||||||
|
resolution: 2160
|
||||||
|
- id: 18
|
||||||
|
qualities:
|
||||||
|
- id: 18
|
||||||
|
name: WEBDL-2160p
|
||||||
|
source: web
|
||||||
|
resolution: 2160
|
||||||
|
- id: 19
|
||||||
|
qualities:
|
||||||
|
- id: 19
|
||||||
|
name: Bluray-2160p
|
||||||
|
source: bluray
|
||||||
|
resolution: 2160
|
||||||
|
format_items:
|
||||||
|
- name: hdr10
|
||||||
|
format: hdr10
|
||||||
|
score: 2000
|
||||||
|
- name: release_AsmoFuscated
|
||||||
|
format: release_AsmoFuscated
|
||||||
|
score: 600
|
||||||
|
- name: release_d3g
|
||||||
|
format: release_d3g
|
||||||
|
score: 1000
|
||||||
|
- name: release_iVy
|
||||||
|
format: release_iVy
|
||||||
|
score: 400
|
||||||
|
- name: format_av1
|
||||||
|
format: format_av1
|
||||||
|
score: -2000
|
||||||
|
- name: source_hdtv
|
||||||
|
format: source_hdtv
|
||||||
|
score: 50
|
||||||
|
- name: source_webdl
|
||||||
|
format: source_webdl
|
||||||
|
score: 100
|
||||||
|
- name: source_bluray
|
||||||
|
format: source_bluray
|
||||||
|
score: 200
|
||||||
|
- name: size_3000_6000
|
||||||
|
format: size_3000_6000
|
||||||
|
score: 300
|
||||||
|
- name: size_6000_10000
|
||||||
|
format: size_6000_10000
|
||||||
|
score: 400
|
||||||
|
- name: size_1500_3000
|
||||||
|
format: size_1500_3000
|
||||||
|
score: 200
|
||||||
|
- name: size_800_1500
|
||||||
|
format: size_800_1500
|
||||||
|
score: 100
|
||||||
|
- name: hvec_10bit
|
||||||
|
format: hvec_10bit
|
||||||
|
score: 500
|
||||||
|
- name: resolution_2160p
|
||||||
|
format: resolution_2160p
|
||||||
|
score: 500
|
||||||
|
- name: resolution_720p
|
||||||
|
format: resolution_720p
|
||||||
|
score: 50
|
||||||
|
- name: resolution_1080p
|
||||||
|
format: resolution_1080p
|
||||||
|
score: 150
|
||||||
|
- name: format_x265
|
||||||
|
format: format_x265
|
||||||
|
score: 1000
|
||||||
|
- name: format_x264
|
||||||
|
format: format_x264
|
||||||
|
score: -1000
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
upgrade_allowed: false
|
||||||
|
cutoff: 1
|
||||||
|
cutoff_format_score: 0
|
||||||
|
min_format_score: 0
|
||||||
|
quality_groups:
|
||||||
|
- id: 1
|
||||||
|
qualities:
|
||||||
|
- id: 1
|
||||||
|
name: SDTV
|
||||||
|
source: television
|
||||||
|
resolution: 480
|
||||||
|
- id: 1000
|
||||||
|
name: "WEB 480p"
|
||||||
|
qualities:
|
||||||
|
- id: 12
|
||||||
|
name: WEBRip-480p
|
||||||
|
source: webRip
|
||||||
|
resolution: 480
|
||||||
|
- id: 8
|
||||||
|
name: WEBDL-480p
|
||||||
|
source: web
|
||||||
|
resolution: 480
|
||||||
|
- id: 2
|
||||||
|
qualities:
|
||||||
|
- id: 2
|
||||||
|
name: DVD
|
||||||
|
source: dvd
|
||||||
|
resolution: 480
|
||||||
|
format_items: []
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
path: "/shared/media/tvseries"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
generate "backend" {
|
||||||
|
path = "backend.tf"
|
||||||
|
if_exists = "overwrite"
|
||||||
|
contents = <<EOF
|
||||||
|
provider "sonarr" {
|
||||||
|
url = "https://${path_relative_to_include()}"
|
||||||
|
api_key = var.sonarr_api_key
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "sonarr_api_key" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
terraform {
|
||||||
|
backend "consul" {
|
||||||
|
address = "https://consul.service.consul"
|
||||||
|
path = "infra/terraform/sonarr/${path_relative_to_include()}/state"
|
||||||
|
scheme = "https"
|
||||||
|
lock = true
|
||||||
|
ca_file = "/etc/pki/tls/certs/ca-bundle.crt"
|
||||||
|
}
|
||||||
|
required_version = ">= 1.10"
|
||||||
|
required_providers {
|
||||||
|
sonarr = {
|
||||||
|
source = "devopsarr/sonarr"
|
||||||
|
version = "3.4.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
include "root" {
|
||||||
|
path = find_in_parent_folders("root.hcl")
|
||||||
|
expose = true
|
||||||
|
}
|
||||||
|
|
||||||
|
include "config" {
|
||||||
|
path = "${get_repo_root()}/config/config.hcl"
|
||||||
|
expose = true
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
config = include.config.locals.config
|
||||||
|
}
|
||||||
|
|
||||||
|
terraform {
|
||||||
|
source = "../../modules/sonarr"
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
custom_formats = local.config.custom_formats
|
||||||
|
quality_profiles = local.config.quality_profiles
|
||||||
|
download_clients = local.config.download_clients
|
||||||
|
indexers = local.config.indexers
|
||||||
|
notifications = local.config.notifications
|
||||||
|
delay_profiles = local.config.delay_profiles
|
||||||
|
root_folders = local.config.root_folders
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
resource "sonarr_custom_format" "this" {
|
||||||
|
for_each = var.custom_formats
|
||||||
|
name = each.key
|
||||||
|
include_custom_format_when_renaming = lookup(each.value, "include_custom_format_when_renaming", false)
|
||||||
|
|
||||||
|
dynamic "specifications" {
|
||||||
|
for_each = each.value.specifications
|
||||||
|
content {
|
||||||
|
name = specifications.value.name
|
||||||
|
implementation = specifications.value.implementation
|
||||||
|
negate = lookup(specifications.value, "negate", false)
|
||||||
|
required = lookup(specifications.value, "required", false)
|
||||||
|
|
||||||
|
dynamic "fields" {
|
||||||
|
for_each = lookup(specifications.value, "fields", [])
|
||||||
|
content {
|
||||||
|
name = fields.value.name
|
||||||
|
value = tostring(lookup(fields.value, "value", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_quality_profile" "this" {
|
||||||
|
for_each = var.quality_profiles
|
||||||
|
name = each.key
|
||||||
|
upgrade_allowed = lookup(each.value, "upgrade_allowed", false)
|
||||||
|
cutoff = each.value.cutoff
|
||||||
|
cutoff_format_score = lookup(each.value, "cutoff_format_score", 0)
|
||||||
|
min_format_score = lookup(each.value, "min_format_score", 0)
|
||||||
|
|
||||||
|
dynamic "quality_groups" {
|
||||||
|
for_each = each.value.quality_groups
|
||||||
|
content {
|
||||||
|
id = quality_groups.value.id
|
||||||
|
name = lookup(quality_groups.value, "name", null)
|
||||||
|
|
||||||
|
dynamic "qualities" {
|
||||||
|
for_each = quality_groups.value.qualities
|
||||||
|
content {
|
||||||
|
id = qualities.value.id
|
||||||
|
name = qualities.value.name
|
||||||
|
source = qualities.value.source
|
||||||
|
resolution = qualities.value.resolution
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "format_items" {
|
||||||
|
for_each = lookup(each.value, "format_items", [])
|
||||||
|
content {
|
||||||
|
name = format_items.value.name
|
||||||
|
format = format_items.value.format
|
||||||
|
score = format_items.value.score
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_download_client_nzbget" "this" {
|
||||||
|
for_each = var.download_clients
|
||||||
|
name = each.key
|
||||||
|
enable = lookup(each.value, "enable", true)
|
||||||
|
priority = lookup(each.value, "priority", 1)
|
||||||
|
host = each.value.host
|
||||||
|
port = each.value.port
|
||||||
|
use_ssl = lookup(each.value, "use_ssl", false)
|
||||||
|
username = lookup(each.value, "username", "")
|
||||||
|
password = lookup(each.value, "password", "")
|
||||||
|
tv_category = lookup(each.value, "tv_category", "")
|
||||||
|
remove_completed_downloads = lookup(each.value, "remove_completed_downloads", true)
|
||||||
|
remove_failed_downloads = lookup(each.value, "remove_failed_downloads", true)
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_indexer_newznab" "this" {
|
||||||
|
for_each = var.indexers
|
||||||
|
name = each.key
|
||||||
|
enable_automatic_search = lookup(each.value, "enable_automatic_search", true)
|
||||||
|
enable_interactive_search = lookup(each.value, "enable_interactive_search", true)
|
||||||
|
enable_rss = lookup(each.value, "enable_rss", true)
|
||||||
|
priority = lookup(each.value, "priority", 25)
|
||||||
|
base_url = each.value.base_url
|
||||||
|
api_path = lookup(each.value, "api_path", "/api")
|
||||||
|
api_key = lookup(each.value, "api_key", "")
|
||||||
|
categories = lookup(each.value, "categories", [])
|
||||||
|
anime_categories = lookup(each.value, "anime_categories", [])
|
||||||
|
season_search_maximum_single_episode_age = lookup(each.value, "season_search_maximum_single_episode_age", 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_notification_emby" "this" {
|
||||||
|
for_each = var.notifications
|
||||||
|
name = each.key
|
||||||
|
host = each.value.host
|
||||||
|
port = each.value.port
|
||||||
|
use_ssl = lookup(each.value, "use_ssl", false)
|
||||||
|
api_key = lookup(each.value, "api_key", "")
|
||||||
|
notify = lookup(each.value, "notify", false)
|
||||||
|
update_library = lookup(each.value, "update_library", true)
|
||||||
|
|
||||||
|
on_grab = lookup(each.value, "on_grab", true)
|
||||||
|
on_download = lookup(each.value, "on_download", true)
|
||||||
|
on_upgrade = lookup(each.value, "on_upgrade", true)
|
||||||
|
on_rename = lookup(each.value, "on_rename", true)
|
||||||
|
on_series_add = lookup(each.value, "on_series_add", true)
|
||||||
|
on_series_delete = lookup(each.value, "on_series_delete", true)
|
||||||
|
on_episode_file_delete = lookup(each.value, "on_episode_file_delete", true)
|
||||||
|
on_episode_file_delete_for_upgrade = lookup(each.value, "on_episode_file_delete_for_upgrade", true)
|
||||||
|
on_application_update = lookup(each.value, "on_application_update", true)
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_delay_profile" "this" {
|
||||||
|
for_each = var.delay_profiles
|
||||||
|
enable_usenet = lookup(each.value, "enable_usenet", true)
|
||||||
|
enable_torrent = lookup(each.value, "enable_torrent", true)
|
||||||
|
preferred_protocol = lookup(each.value, "preferred_protocol", "usenet")
|
||||||
|
usenet_delay = lookup(each.value, "usenet_delay", 0)
|
||||||
|
torrent_delay = lookup(each.value, "torrent_delay", 0)
|
||||||
|
bypass_if_highest_quality = lookup(each.value, "bypass_if_highest_quality", true)
|
||||||
|
bypass_if_above_custom_format_score = lookup(each.value, "bypass_if_above_custom_format_score", false)
|
||||||
|
minimum_custom_format_score = lookup(each.value, "minimum_custom_format_score", 0)
|
||||||
|
tags = lookup(each.value, "tags", [])
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "sonarr_root_folder" "this" {
|
||||||
|
for_each = var.root_folders
|
||||||
|
path = each.value.path
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
variable "custom_formats" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "quality_profiles" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "download_clients" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "indexers" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "notifications" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "delay_profiles" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "root_folders" {
|
||||||
|
type = map(any)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user