- add exporters::exportarr - deploy for radarr, sonarr and prowlarr
This commit is contained in:
parent
fd902c1437
commit
286bfb6946
@ -3,6 +3,7 @@ hiera_include:
|
|||||||
- prowlarr
|
- prowlarr
|
||||||
- profiles::nginx::ldapauth
|
- profiles::nginx::ldapauth
|
||||||
- profiles::media::prowlarr
|
- profiles::media::prowlarr
|
||||||
|
- exporters::exportarr
|
||||||
|
|
||||||
# manage prowlarr
|
# manage prowlarr
|
||||||
prowlarr::params::user: prowlarr
|
prowlarr::params::user: prowlarr
|
||||||
@ -11,6 +12,12 @@ prowlarr::params::manage_group: false
|
|||||||
prowlarr::params::archive_version: 1.19.0
|
prowlarr::params::archive_version: 1.19.0
|
||||||
prowlarr::params::port: 8000
|
prowlarr::params::port: 8000
|
||||||
|
|
||||||
|
# exportarr
|
||||||
|
exporters::exportarr::enable: true
|
||||||
|
exporters::exportarr::app: prowlarr
|
||||||
|
exporters::exportarr::api_key: "%{hiera('prowlarr::api_key')}"
|
||||||
|
exporters::exportarr::backfill: true
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
profiles::pki::vault::alt_names:
|
profiles::pki::vault::alt_names:
|
||||||
- prowlarr.main.unkin.net
|
- prowlarr.main.unkin.net
|
||||||
@ -55,6 +62,9 @@ profiles::consul::client::node_rules:
|
|||||||
- resource: service
|
- resource: service
|
||||||
segment: prowlarr
|
segment: prowlarr
|
||||||
disposition: write
|
disposition: write
|
||||||
|
- resource: service
|
||||||
|
segment: exportarr
|
||||||
|
disposition: write
|
||||||
|
|
||||||
profiles::nginx::simpleproxy::locations:
|
profiles::nginx::simpleproxy::locations:
|
||||||
arrstack_web_external:
|
arrstack_web_external:
|
||||||
|
|||||||
@ -3,6 +3,7 @@ hiera_include:
|
|||||||
- radarr
|
- radarr
|
||||||
- profiles::nginx::ldapauth
|
- profiles::nginx::ldapauth
|
||||||
- profiles::media::radarr
|
- profiles::media::radarr
|
||||||
|
- exporters::exportarr
|
||||||
|
|
||||||
# manage radarr
|
# manage radarr
|
||||||
radarr::params::user: radarr
|
radarr::params::user: radarr
|
||||||
@ -11,6 +12,10 @@ radarr::params::manage_group: false
|
|||||||
radarr::params::archive_version: 5.7.0
|
radarr::params::archive_version: 5.7.0
|
||||||
radarr::params::port: 8000
|
radarr::params::port: 8000
|
||||||
|
|
||||||
|
# exportarr
|
||||||
|
exporters::exportarr::enable: true
|
||||||
|
exporters::exportarr::app: radarr
|
||||||
|
exporters::exportarr::api_key: "%{hiera('radarr::api_key')}"
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
profiles::pki::vault::alt_names:
|
profiles::pki::vault::alt_names:
|
||||||
@ -56,3 +61,6 @@ profiles::consul::client::node_rules:
|
|||||||
- resource: service
|
- resource: service
|
||||||
segment: radarr
|
segment: radarr
|
||||||
disposition: write
|
disposition: write
|
||||||
|
- resource: service
|
||||||
|
segment: exportarr
|
||||||
|
disposition: write
|
||||||
|
|||||||
@ -3,6 +3,7 @@ hiera_include:
|
|||||||
- sonarr
|
- sonarr
|
||||||
- profiles::nginx::ldapauth
|
- profiles::nginx::ldapauth
|
||||||
- profiles::media::sonarr
|
- profiles::media::sonarr
|
||||||
|
- exporters::exportarr
|
||||||
|
|
||||||
# manage sonarr
|
# manage sonarr
|
||||||
sonarr::params::user: sonarr
|
sonarr::params::user: sonarr
|
||||||
@ -11,6 +12,11 @@ sonarr::params::manage_group: false
|
|||||||
sonarr::params::archive_version: 4.0.5
|
sonarr::params::archive_version: 4.0.5
|
||||||
sonarr::params::port: 8000
|
sonarr::params::port: 8000
|
||||||
|
|
||||||
|
# exportarr
|
||||||
|
exporters::exportarr::enable: true
|
||||||
|
exporters::exportarr::app: sonarr
|
||||||
|
exporters::exportarr::api_key: "%{hiera('sonarr::api_key')}"
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
profiles::pki::vault::alt_names:
|
profiles::pki::vault::alt_names:
|
||||||
- sonarr.main.unkin.net
|
- sonarr.main.unkin.net
|
||||||
@ -55,3 +61,6 @@ profiles::consul::client::node_rules:
|
|||||||
- resource: service
|
- resource: service
|
||||||
segment: sonarr
|
segment: sonarr
|
||||||
disposition: write
|
disposition: write
|
||||||
|
- resource: service
|
||||||
|
segment: exportarr
|
||||||
|
disposition: write
|
||||||
|
|||||||
73
modules/exporters/manifests/exportarr.pp
Normal file
73
modules/exporters/manifests/exportarr.pp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
class exporters::exportarr (
|
||||||
|
String $app,
|
||||||
|
String $api_key,
|
||||||
|
Boolean $backfill = false, # only for prowlarr
|
||||||
|
Boolean $extra_metrics = false,
|
||||||
|
Boolean $enable = false,
|
||||||
|
String $user = 'exportarr',
|
||||||
|
String $group = 'exportarr',
|
||||||
|
Boolean $manage_user = true,
|
||||||
|
Boolean $manage_service = true,
|
||||||
|
Stdlib::Port $port = 9707,
|
||||||
|
Stdlib::HTTPUrl $url = 'http://127.0.0.1:8000',
|
||||||
|
Stdlib::Absolutepath $exec_path = '/usr/bin/exportarr',
|
||||||
|
Stdlib::Absolutepath $config_file = "/opt/${app}/config.xml",
|
||||||
|
){
|
||||||
|
|
||||||
|
if $enable {
|
||||||
|
|
||||||
|
# install required package
|
||||||
|
package {'exportarr':
|
||||||
|
ensure => installed,
|
||||||
|
}
|
||||||
|
|
||||||
|
# manage the user/group
|
||||||
|
if $manage_user {
|
||||||
|
group { $group:
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
user { $user:
|
||||||
|
ensure => present,
|
||||||
|
shell => '/usr/sbin/nologin',
|
||||||
|
groups => $group,
|
||||||
|
managehome => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# manage the systemd service
|
||||||
|
if $manage_service {
|
||||||
|
|
||||||
|
# Use these in notifications or file resources
|
||||||
|
systemd::unit_file { 'exportarr.service':
|
||||||
|
content => template('exporters/exportarr.service.erb'),
|
||||||
|
enable => true,
|
||||||
|
active => true,
|
||||||
|
subscribe => Package['exportarr'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# manage consul service
|
||||||
|
consul::service { 'exportarr':
|
||||||
|
service_name => 'exportarr',
|
||||||
|
address => $facts['networking']['ip'],
|
||||||
|
port => $port,
|
||||||
|
tags => [
|
||||||
|
'metrics',
|
||||||
|
'metrics_scheme=http',
|
||||||
|
'metrics_job=exportarr',
|
||||||
|
],
|
||||||
|
checks => [
|
||||||
|
{
|
||||||
|
id => 'exportarr_http_check',
|
||||||
|
name => 'exportarr HTTP Check',
|
||||||
|
http => "http://${facts['networking']['fqdn']}:${port}",
|
||||||
|
method => 'GET',
|
||||||
|
tls_skip_verify => true,
|
||||||
|
interval => '10s',
|
||||||
|
timeout => '1s',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
modules/exporters/templates/exportarr.service.erb
Normal file
16
modules/exporters/templates/exportarr.service.erb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Prometheus exportarr
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=<%= @user %>
|
||||||
|
Group=<%= @group %>
|
||||||
|
EnvironmentFile=<%= @vars_file %>
|
||||||
|
ExecStart=<%= @exec_path %> <%= @app %> --port <%= @port %> --url <%= @url %> --api-key <%= @api_key %> --config <%= @config_file %> --enable-additional-metrics <%= @extra_metrics %><% if @app == 'prowlarr' %> --backfill <%= @backfill %><% end %>
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
KillMode=process
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
4
modules/exporters/templates/sysconfig.erb
Normal file
4
modules/exporters/templates/sysconfig.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# THIS FILE IS MANAGED BY PUPPET
|
||||||
|
<% @options.each do |key, value| -%>
|
||||||
|
<%= key %>=<%= value %>
|
||||||
|
<% end -%>
|
||||||
Loading…
Reference in New Issue
Block a user