All checks were successful
Build / precommit (pull_request) Successful in 5m8s
- add exporters::exportarr - deploy for radarr, sonarr and prowlarr
74 lines
1.9 KiB
Puppet
74 lines
1.9 KiB
Puppet
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',
|
|
},
|
|
],
|
|
}
|
|
}
|
|
}
|