feat: add exportarr (#365)
- add exporters::exportarr - deploy for radarr, sonarr and prowlarr Reviewed-on: #365
This commit is contained in:
parent
fd902c1437
commit
7fbb87b4b6
@ -3,6 +3,7 @@ hiera_include:
|
||||
- prowlarr
|
||||
- profiles::nginx::ldapauth
|
||||
- profiles::media::prowlarr
|
||||
- exporters::exportarr
|
||||
|
||||
# manage prowlarr
|
||||
prowlarr::params::user: prowlarr
|
||||
@ -11,6 +12,12 @@ prowlarr::params::manage_group: false
|
||||
prowlarr::params::archive_version: 1.19.0
|
||||
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
|
||||
profiles::pki::vault::alt_names:
|
||||
- prowlarr.main.unkin.net
|
||||
@ -55,6 +62,9 @@ profiles::consul::client::node_rules:
|
||||
- resource: service
|
||||
segment: prowlarr
|
||||
disposition: write
|
||||
- resource: service
|
||||
segment: exportarr
|
||||
disposition: write
|
||||
|
||||
profiles::nginx::simpleproxy::locations:
|
||||
arrstack_web_external:
|
||||
|
||||
@ -3,6 +3,7 @@ hiera_include:
|
||||
- radarr
|
||||
- profiles::nginx::ldapauth
|
||||
- profiles::media::radarr
|
||||
- exporters::exportarr
|
||||
|
||||
# manage radarr
|
||||
radarr::params::user: radarr
|
||||
@ -11,6 +12,10 @@ radarr::params::manage_group: false
|
||||
radarr::params::archive_version: 5.7.0
|
||||
radarr::params::port: 8000
|
||||
|
||||
# exportarr
|
||||
exporters::exportarr::enable: true
|
||||
exporters::exportarr::app: radarr
|
||||
exporters::exportarr::api_key: "%{hiera('radarr::api_key')}"
|
||||
|
||||
# additional altnames
|
||||
profiles::pki::vault::alt_names:
|
||||
@ -56,3 +61,6 @@ profiles::consul::client::node_rules:
|
||||
- resource: service
|
||||
segment: radarr
|
||||
disposition: write
|
||||
- resource: service
|
||||
segment: exportarr
|
||||
disposition: write
|
||||
|
||||
@ -3,6 +3,7 @@ hiera_include:
|
||||
- sonarr
|
||||
- profiles::nginx::ldapauth
|
||||
- profiles::media::sonarr
|
||||
- exporters::exportarr
|
||||
|
||||
# manage sonarr
|
||||
sonarr::params::user: sonarr
|
||||
@ -11,6 +12,11 @@ sonarr::params::manage_group: false
|
||||
sonarr::params::archive_version: 4.0.5
|
||||
sonarr::params::port: 8000
|
||||
|
||||
# exportarr
|
||||
exporters::exportarr::enable: true
|
||||
exporters::exportarr::app: sonarr
|
||||
exporters::exportarr::api_key: "%{hiera('sonarr::api_key')}"
|
||||
|
||||
# additional altnames
|
||||
profiles::pki::vault::alt_names:
|
||||
- sonarr.main.unkin.net
|
||||
@ -55,3 +61,6 @@ profiles::consul::client::node_rules:
|
||||
- resource: service
|
||||
segment: sonarr
|
||||
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