neoloc/radarr #64
@ -2,6 +2,13 @@
|
|||||||
networking::interfaces:
|
networking::interfaces:
|
||||||
eth0:
|
eth0:
|
||||||
ipaddress: 198.18.13.50
|
ipaddress: 198.18.13.50
|
||||||
|
ens19:
|
||||||
|
ensure: present
|
||||||
|
family: inet
|
||||||
|
method: static
|
||||||
|
ipaddress: 10.18.15.50
|
||||||
|
netmask: 255.255.255.0
|
||||||
|
onboot: true
|
||||||
networking::routes:
|
networking::routes:
|
||||||
default:
|
default:
|
||||||
gateway: 198.18.13.254
|
gateway: 198.18.13.254
|
||||||
|
|||||||
2
hieradata/roles/apps/media/radarr.eyaml
Normal file
2
hieradata/roles/apps/media/radarr.eyaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
radarr::api_key: ENC[PKCS7,MIIBmQYJKoZIhvcNAQcDoIIBijCCAYYCAQAxggEhMIIBHQIBADAFMAACAQEwDQYJKoZIhvcNAQEBBQAEggEALtNnNr2N7DpP9zx5anmQavFmsTLIyPkpJGCkJpUTHMYFSScS/3FOUuufajk4Cmu4FbPswp/N/U1nHO8oLF6xNQ+H77+xXuKPalW/3R1IRqGoczwsAfstJ6nYF+PLjjeK2TDP+KMs3Eg2+nrXB7NOVOP88RvDLyZq93Wn9qR+1VG6Y2gLqGSJArZpNilV5ygUYRgbMeckjqfLynYBXtgDQQLYNhxDO6WGRRv+0X773nmOdrWFAUjqF6/K+Ejjk5ZbaqnGyjljMstSrhg7NWxtMRbCjeMpjUjUS4Hn/Vayg2M2Ag2s87gsE1e4QFa6KP7GVRu3swvyZ3D54Ba/xrebxzBcBgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBDD6gIEfNGPXA8zv/vysgxJgDADMi7Fx5q+aqTMeqcKLg1AukTlCnJ62zykm6RNGdS0KlpJsvTSmWF4So3v/9BsKdk=]
|
||||||
56
hieradata/roles/apps/media/radarr.yaml
Normal file
56
hieradata/roles/apps/media/radarr.yaml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
hiera_include:
|
||||||
|
- radarr
|
||||||
|
- profiles::nginx::simpleproxy
|
||||||
|
|
||||||
|
# manage radarr
|
||||||
|
radarr::params:
|
||||||
|
user: radarr
|
||||||
|
group: radarr
|
||||||
|
base_path: /opt/radarr
|
||||||
|
install_path: /opt/radarr/bin
|
||||||
|
archive_version: 5.7.0
|
||||||
|
archive_name: Radarr.master.linux-core-x64.tar.gz
|
||||||
|
service_enable: true
|
||||||
|
service_name: radarr
|
||||||
|
|
||||||
|
# additional altnames
|
||||||
|
profiles::pki::vault::alt_names:
|
||||||
|
- radarr.main.unkin.net
|
||||||
|
- radarr.service.consul
|
||||||
|
- radarr.query.consul
|
||||||
|
- "radarr.service.%{facts.country}-%{facts.region}.consul"
|
||||||
|
|
||||||
|
# manage a simple nginx reverse proxy
|
||||||
|
profiles::nginx::simpleproxy::nginx_vhost: 'radarr.query.consul'
|
||||||
|
profiles::nginx::simpleproxy::nginx_aliases:
|
||||||
|
- radarr.main.unkin.net
|
||||||
|
- radarr.service.consul
|
||||||
|
- radarr.query.consul
|
||||||
|
- "radarr.service.%{facts.country}-%{facts.region}.consul"
|
||||||
|
profiles::nginx::simpleproxy::proxy_port: 7878
|
||||||
|
profiles::nginx::simpleproxy::proxy_host: 127.0.0.1
|
||||||
|
profiles::nginx::simpleproxy::proxy_path: '/'
|
||||||
|
|
||||||
|
# configure consul service
|
||||||
|
nginx::client_max_body_size: 10M
|
||||||
|
consul::services:
|
||||||
|
radarr:
|
||||||
|
service_name: 'radarr'
|
||||||
|
tags:
|
||||||
|
- 'media'
|
||||||
|
- 'radarr'
|
||||||
|
address: "%{facts.networking.ip}"
|
||||||
|
port: 443
|
||||||
|
checks:
|
||||||
|
- id: 'radarr_http_check'
|
||||||
|
name: 'radarr HTTP Check'
|
||||||
|
http: "https://%{facts.networking.fqdn}:443"
|
||||||
|
method: 'GET'
|
||||||
|
tls_skip_verify: true
|
||||||
|
interval: '10s'
|
||||||
|
timeout: '1s'
|
||||||
|
profiles::consul::client::node_rules:
|
||||||
|
- resource: service
|
||||||
|
segment: radarr
|
||||||
|
disposition: write
|
||||||
27
modules/radarr/manifests/config.pp
Normal file
27
modules/radarr/manifests/config.pp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class radarr::config (
|
||||||
|
$user = $radarr::params::user,
|
||||||
|
$group = $radarr::params::group,
|
||||||
|
$base_path = $radarr::params::base_path,
|
||||||
|
$bind_address = $radarr::bind_address,
|
||||||
|
$port = $radarr::port,
|
||||||
|
$ssl_port = $radarr::ssl_port,
|
||||||
|
$enable_ssl = $radarr::enable_ssl,
|
||||||
|
$launch_browser = $radarr::launch_browser,
|
||||||
|
$api_key = $radarr::api_key,
|
||||||
|
$authentication_method = $radarr::authentication_method,
|
||||||
|
$authentication_required = $radarr::authentication_required,
|
||||||
|
$branch = $radarr::branch,
|
||||||
|
$log_level = $radarr::log_level,
|
||||||
|
$ssl_cert_path = $radarr::ssl_cert_path,
|
||||||
|
$ssl_cert_password = $radarr::ssl_cert_password,
|
||||||
|
$url_base = $radarr::url_base,
|
||||||
|
$instance_name = $radarr::instance_name,
|
||||||
|
) {
|
||||||
|
file { "${base_path}/config.xml":
|
||||||
|
ensure => file,
|
||||||
|
content => template('radarr/radarr_config.xml.erb'),
|
||||||
|
owner => $user,
|
||||||
|
group => $group,
|
||||||
|
mode => '0644',
|
||||||
|
}
|
||||||
|
}
|
||||||
36
modules/radarr/manifests/init.pp
Normal file
36
modules/radarr/manifests/init.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# manage radarr
|
||||||
|
class radarr (
|
||||||
|
$packages = $radarr::params::packages,
|
||||||
|
$user = $radarr::params::user,
|
||||||
|
$group = $radarr::params::group,
|
||||||
|
$base_path = $radarr::params::base_path,
|
||||||
|
$install_path = $radarr::params::install_path,
|
||||||
|
$config_folder = $radarr::params::config_folder,
|
||||||
|
$app_folder = $radarr::params::app_folder,
|
||||||
|
$archive_name = $radarr::params::archive_name,
|
||||||
|
$archive_url = $radarr::params::archive_url,
|
||||||
|
$executable = $radarr::params::executable,
|
||||||
|
$service_enable = $radarr::params::service_enable,
|
||||||
|
$service_name = $radarr::params::service_name,
|
||||||
|
$bind_address = $radarr::params::bind_address,
|
||||||
|
$port = $radarr::params::port,
|
||||||
|
$ssl_port = $radarr::params::ssl_port,
|
||||||
|
$enable_ssl = $radarr::params::enable_ssl,
|
||||||
|
$launch_browser = $radarr::params::launch_browser,
|
||||||
|
$api_key = $radarr::params::api_key,
|
||||||
|
$authentication_method = $radarr::params::authentication_method,
|
||||||
|
$authentication_required = $radarr::params::authentication_required,
|
||||||
|
$branch = $radarr::params::branch,
|
||||||
|
$log_level = $radarr::params::log_level,
|
||||||
|
$ssl_cert_path = $radarr::params::ssl_cert_path,
|
||||||
|
$ssl_cert_password = $radarr::params::ssl_cert_password,
|
||||||
|
$url_base = $radarr::params::url_base,
|
||||||
|
$instance_name = $radarr::params::instance_name,
|
||||||
|
) inherits radarr::params {
|
||||||
|
|
||||||
|
include radarr::install
|
||||||
|
include radarr::config
|
||||||
|
include radarr::service
|
||||||
|
|
||||||
|
Class['radarr::install'] -> Class['radarr::config'] -> Class['radarr::service']
|
||||||
|
}
|
||||||
58
modules/radarr/manifests/install.pp
Normal file
58
modules/radarr/manifests/install.pp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# instsall radarr
|
||||||
|
class radarr::install (
|
||||||
|
$packages = $radarr::packages,
|
||||||
|
$user = $radarr::user,
|
||||||
|
$group = $radarr::group,
|
||||||
|
$base_path = $radarr::base_path,
|
||||||
|
$install_path = $radarr::install_path,
|
||||||
|
$config_folder = $radarr::config_folder,
|
||||||
|
$app_folder = $radarr::app_folder,
|
||||||
|
$archive_name = $radarr::archive_name,
|
||||||
|
$archive_url = $radarr::archive_url,
|
||||||
|
$executable = $radarr::executable,
|
||||||
|
) {
|
||||||
|
|
||||||
|
$_packages = $packages ? {
|
||||||
|
Array => true,
|
||||||
|
default => false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if $_packages {
|
||||||
|
ensure_packages($packages, {ensure => 'installed'})
|
||||||
|
}
|
||||||
|
|
||||||
|
group { $group:
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
user { $user:
|
||||||
|
ensure => present,
|
||||||
|
shell => '/sbin/nologin',
|
||||||
|
groups => $group,
|
||||||
|
managehome => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { [ $base_path, $install_path, $config_folder, $app_folder ]:
|
||||||
|
ensure => directory,
|
||||||
|
owner => $user,
|
||||||
|
group => $group,
|
||||||
|
}
|
||||||
|
|
||||||
|
archive { $archive_name:
|
||||||
|
path => "/tmp/${archive_name}",
|
||||||
|
source => "${archive_url}${archive_name}",
|
||||||
|
extract => true,
|
||||||
|
extract_path => $install_path,
|
||||||
|
creates => "${install_path}/${executable}",
|
||||||
|
cleanup => true,
|
||||||
|
require => File[$install_path],
|
||||||
|
user => $user,
|
||||||
|
group => $group,
|
||||||
|
notify => Exec['move_radarr_files'],
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'move_radarr_files':
|
||||||
|
command => "/usr/bin/mv ${install_path}/Radarr/* ${install_path}",
|
||||||
|
creates => "${install_path}/${executable}",
|
||||||
|
}
|
||||||
|
}
|
||||||
48
modules/radarr/manifests/params.pp
Normal file
48
modules/radarr/manifests/params.pp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# radarr params
|
||||||
|
class radarr::params (
|
||||||
|
Array[String] $packages = [
|
||||||
|
'mediainfo',
|
||||||
|
'libzen',
|
||||||
|
'libmediainfo',
|
||||||
|
'gettext',
|
||||||
|
'sqlite.x86_64',
|
||||||
|
'par2cmdline',
|
||||||
|
'python3-feedparser',
|
||||||
|
'python3-configobj',
|
||||||
|
'python3-cheetah',
|
||||||
|
'python3-dbus',
|
||||||
|
'libxslt-devel'
|
||||||
|
],
|
||||||
|
String $user = 'radarr',
|
||||||
|
String $group = 'radarr',
|
||||||
|
Stdlib::Absolutepath $base_path = '/opt/radarr',
|
||||||
|
Stdlib::Absolutepath $install_path = '/opt/radarr/bin',
|
||||||
|
Stdlib::Absolutepath $config_folder = '/home/radarr/.config',
|
||||||
|
Stdlib::Absolutepath $app_folder = '/home/radarr/.config/Radarr',
|
||||||
|
String $archive_version = '5.7.0',
|
||||||
|
String $archive_name = 'Radarr.master.linux-core-x64.tar.gz',
|
||||||
|
Stdlib::HTTPUrl $archive_url = "https://git.query.consul/api/packages/unkinben/generic/radarr/${archive_version}/",
|
||||||
|
String $executable = 'Radarr/Radarr',
|
||||||
|
String $service_name = 'radarr',
|
||||||
|
Boolean $service_enable = true,
|
||||||
|
|
||||||
|
# params for the configuration file
|
||||||
|
Stdlib::Host $bind_address = '127.0.0.1',
|
||||||
|
Stdlib::Port $port = 7878,
|
||||||
|
Stdlib::Port $ssl_port = 7979,
|
||||||
|
Boolean $enable_ssl = false,
|
||||||
|
Boolean $launch_browser = true,
|
||||||
|
String $api_key = '32-digit-random-string-goes-here',
|
||||||
|
Enum[
|
||||||
|
'Forms',
|
||||||
|
'Basic',
|
||||||
|
'External'
|
||||||
|
] $authentication_method = 'External',
|
||||||
|
Enum['Enabled', 'Disabled'] $authentication_required = 'Enabled',
|
||||||
|
String $branch = 'main',
|
||||||
|
Enum['debug', 'info', 'warn', 'error', 'fatal'] $log_level = 'info',
|
||||||
|
Optional[String] $ssl_cert_path = undef,
|
||||||
|
Optional[String] $ssl_cert_password = undef,
|
||||||
|
Optional[String] $url_base = undef,
|
||||||
|
String $instance_name = 'radarr',
|
||||||
|
) { }
|
||||||
21
modules/radarr/manifests/service.pp
Normal file
21
modules/radarr/manifests/service.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# manage radarr service
|
||||||
|
class radarr::service (
|
||||||
|
$service_enable = $radarr::service_enable,
|
||||||
|
$service_name = $radarr::service_name,
|
||||||
|
$user = $radarr::user,
|
||||||
|
$group = $radarr::user,
|
||||||
|
$install_path = $radarr::install_path,
|
||||||
|
$executable = $radarr::executable,
|
||||||
|
$base_path = $radarr::base_path,
|
||||||
|
) {
|
||||||
|
if $service_enable {
|
||||||
|
include ::systemd
|
||||||
|
|
||||||
|
systemd::unit_file { "${service_name}.service":
|
||||||
|
content => template('radarr/radarr.service.erb'),
|
||||||
|
enable => true,
|
||||||
|
active => true,
|
||||||
|
subscribe => File["${base_path}/config.xml"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
modules/radarr/templates/radarr.service.erb
Normal file
14
modules/radarr/templates/radarr.service.erb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=<%= @service_name %> Daemon
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=<%= @user %>
|
||||||
|
Group=<%= @group %>
|
||||||
|
Type=simple
|
||||||
|
ExecStart=<%= @install_path %>/<%= @executable %> -nobrowser -data=<%= @base_path %>
|
||||||
|
KillMode=process
|
||||||
|
Restart=on-failure
|
||||||
|
TimeoutStopSec=20
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
16
modules/radarr/templates/radarr_config.xml.erb
Normal file
16
modules/radarr/templates/radarr_config.xml.erb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<Config>
|
||||||
|
<BindAddress><%= @bind_address %></BindAddress>
|
||||||
|
<Port><%= @port %></Port>
|
||||||
|
<SslPort><%= @ssl_port %></SslPort>
|
||||||
|
<EnableSsl><%= @enable_ssl.to_s.capitalize %></EnableSsl>
|
||||||
|
<LaunchBrowser><%= @launch_browser.to_s.capitalize %></LaunchBrowser>
|
||||||
|
<ApiKey><%= @api_key %></ApiKey>
|
||||||
|
<AuthenticationMethod><%= @authentication_method %></AuthenticationMethod>
|
||||||
|
<AuthenticationRequired><%= @authentication_required %></AuthenticationRequired>
|
||||||
|
<Branch><%= @branch %></Branch>
|
||||||
|
<LogLevel><%= @log_level %></LogLevel>
|
||||||
|
<SslCertPath><%= @ssl_cert_path || '' %></SslCertPath>
|
||||||
|
<SslCertPassword><%= @ssl_cert_password || '' %></SslCertPassword>
|
||||||
|
<UrlBase><%= @url_base || '' %></UrlBase>
|
||||||
|
<InstanceName><%= @instance_name %></InstanceName>
|
||||||
|
</Config><%- # No newline at the end of the file -%>
|
||||||
16
site/profiles/manifests/media/radarr.pp
Normal file
16
site/profiles/manifests/media/radarr.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# profiles::media::radarr
|
||||||
|
class profiles::media::radarr (
|
||||||
|
Stdlib::Absolutepath $media_root = '/shared/media',
|
||||||
|
) {
|
||||||
|
|
||||||
|
include profiles::ceph::client
|
||||||
|
|
||||||
|
# manage the sharedvol
|
||||||
|
profiles::storage::cephfsvol {"${::facts['networking']['fqdn']}_media":
|
||||||
|
mount => $media_root,
|
||||||
|
keyring => '/etc/ceph/ceph.client.media.keyring',
|
||||||
|
cephfs_name => 'media',
|
||||||
|
cephfs_fs => 'mediafs',
|
||||||
|
require => Profiles::Ceph::Keyring['media'],
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,5 +6,6 @@ class roles::apps::media::radarr {
|
|||||||
}else{
|
}else{
|
||||||
include profiles::defaults
|
include profiles::defaults
|
||||||
include profiles::base
|
include profiles::base
|
||||||
|
include profiles::media::radarr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user