puppet-prod/modules/lidarr/manifests/install.pp
Ben Vincent 2b1ea45e4e feat: add manage_group param to *arr stack
- change hieradata/role/apps/media/* to use correct namespaces
- add manage_group boolean to all *arr stack modules
2024-06-27 23:15:08 +10:00

62 lines
1.5 KiB
Puppet

# instsall lidarr
class lidarr::install (
$packages = $lidarr::packages,
$user = $lidarr::user,
$group = $lidarr::group,
$manage_group = $lidarr::manage_group,
$base_path = $lidarr::base_path,
$install_path = $lidarr::install_path,
$config_folder = $lidarr::config_folder,
$app_folder = $lidarr::app_folder,
$archive_name = $lidarr::archive_name,
$archive_url = $lidarr::archive_url,
$executable = $lidarr::executable,
) {
$_packages = $packages ? {
Array => true,
default => false,
}
if $_packages {
ensure_packages($packages, {ensure => 'installed'})
}
if $manage_group {
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_lidarr_files'],
}
exec { 'move_lidarr_files':
command => "/usr/bin/mv ${install_path}/Lidarr/* ${install_path}",
creates => "${install_path}/${executable}",
}
}