Working version
This commit contains a working version of this Puppet implementation of Radarr.
This commit is contained in:
parent
dd4bdc44e0
commit
0c582b3d8a
83
README.md
Normal file
83
README.md
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
# radarr
|
||||||
|
|
||||||
|
#### Table of Contents
|
||||||
|
|
||||||
|
1. [Description](#description)
|
||||||
|
1. [Setup - The basics of getting started with radarr](#setup)
|
||||||
|
* [What radarr affects](#what-radarr-affects)
|
||||||
|
* [Setup requirements](#setup-requirements)
|
||||||
|
* [Beginning with radarr](#beginning-with-radarr)
|
||||||
|
1. [Usage - Configuration options and additional functionality](#usage)
|
||||||
|
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
||||||
|
1. [Limitations - OS compatibility, etc.](#limitations)
|
||||||
|
1. [Development - Guide for contributing to the module](#development)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Start with a one- or two-sentence summary of what the module does and/or what
|
||||||
|
problem it solves. This is your 30-second elevator pitch for your module.
|
||||||
|
Consider including OS/Puppet version it works with.
|
||||||
|
|
||||||
|
You can give more descriptive information in a second paragraph. This paragraph
|
||||||
|
should answer the questions: "What does this module *do*?" and "Why would I use
|
||||||
|
it?" If your module has a range of functionality (installation, configuration,
|
||||||
|
management, etc.), this is the time to mention it.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### What radarr affects **OPTIONAL**
|
||||||
|
|
||||||
|
If it's obvious what your module touches, you can skip this section. For
|
||||||
|
example, folks can probably figure out that your mysql_instance module affects
|
||||||
|
their MySQL instances.
|
||||||
|
|
||||||
|
If there's more that they should know about, though, this is the place to mention:
|
||||||
|
|
||||||
|
* A list of files, packages, services, or operations that the module will alter,
|
||||||
|
impact, or execute.
|
||||||
|
* Dependencies that your module automatically installs.
|
||||||
|
* Warnings or other important notices.
|
||||||
|
|
||||||
|
### Setup Requirements **OPTIONAL**
|
||||||
|
|
||||||
|
If your module requires anything extra before setting up (pluginsync enabled,
|
||||||
|
etc.), mention it here.
|
||||||
|
|
||||||
|
If your most recent release breaks compatibility or requires particular steps
|
||||||
|
for upgrading, you might want to include an additional "Upgrading" section
|
||||||
|
here.
|
||||||
|
|
||||||
|
### Beginning with radarr
|
||||||
|
|
||||||
|
The very basic steps needed for a user to get the module up and running. This
|
||||||
|
can include setup steps, if necessary, or it can be an example of the most
|
||||||
|
basic use of the module.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
This section is where you describe how to customize, configure, and do the
|
||||||
|
fancy stuff with your module here. It's especially helpful if you include usage
|
||||||
|
examples and code samples for doing things with your module.
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
Here, include a complete list of your module's classes, types, providers,
|
||||||
|
facts, along with the parameters for each. Users refer to this section (thus
|
||||||
|
the name "Reference") to find specific details; most users don't read it per
|
||||||
|
se.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
This is where you list OS compatibility, version compatibility, etc. If there
|
||||||
|
are Known Issues, you might want to include them under their own heading here.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Since your module is awesome, other users will want to play with it. Let them
|
||||||
|
know what the ground rules for contributing are.
|
||||||
|
|
||||||
|
## Release Notes/Contributors/Etc. **Optional**
|
||||||
|
|
||||||
|
If you aren't using changelog, put your release notes here (though you should
|
||||||
|
consider using changelog). You can also add any additional sections you feel
|
||||||
|
are necessary or important to include here. Please use the `## ` header.
|
||||||
28
manifests/init.pp
Normal file
28
manifests/init.pp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# == Class: radarr
|
||||||
|
#
|
||||||
|
class radarr (
|
||||||
|
$manage_epel = $radarr::params::manage_epel,
|
||||||
|
$install_mono = $radarr::params::install_mono,
|
||||||
|
$mono_baseurl = $radarr::params::mono_baseurl,
|
||||||
|
$mono_gpgkey = $radarr::params::mono_gpgkey,
|
||||||
|
$mono_packages = $radarr::params::mono_packages,
|
||||||
|
$additional_packages = $radarr::params::additional_packages,
|
||||||
|
$user = $radarr::params::user,
|
||||||
|
$group = $radarr::params::user,
|
||||||
|
$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,
|
||||||
|
) inherits radarr::params {
|
||||||
|
|
||||||
|
contain radarr::install
|
||||||
|
contain radarr::service
|
||||||
|
|
||||||
|
Class['radarr::install'] ~>
|
||||||
|
Class['radarr::service']
|
||||||
|
}
|
||||||
85
manifests/install.pp
Normal file
85
manifests/install.pp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# == Class: radarr::install
|
||||||
|
#
|
||||||
|
class radarr::install (
|
||||||
|
$manage_epel = $radarr::manage_epel,
|
||||||
|
$install_mono = $radarr::install_mono,
|
||||||
|
$mono_baseurl = $radarr::mono_baseurl,
|
||||||
|
$mono_gpgkey = $radarr::mono_gpgkey,
|
||||||
|
$mono_packages = $radarr::mono_packages,
|
||||||
|
$additional_packages = $radarr::additional_packages,
|
||||||
|
$user = $radarr::user,
|
||||||
|
$group = $radarr::user,
|
||||||
|
$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,
|
||||||
|
) {
|
||||||
|
|
||||||
|
if $manage_epel {
|
||||||
|
package { 'epel-release':
|
||||||
|
ensure => 'installed',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if $install_mono {
|
||||||
|
yumrepo { 'mono':
|
||||||
|
ensure => present,
|
||||||
|
baseurl => $mono_baseurl,
|
||||||
|
gpgkey => $mono_gpgkey,
|
||||||
|
gpgcheck => true,
|
||||||
|
} ->
|
||||||
|
|
||||||
|
package { $mono_packages:
|
||||||
|
ensure => installed,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$_additional_packages = $additional_packages ? {
|
||||||
|
Array => true,
|
||||||
|
default => false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if $_additional_packages {
|
||||||
|
package { $additional_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_url = strip(generate('/bin/sh', '-c', "${archive_url}"))
|
||||||
|
|
||||||
|
archive { $archive_name:
|
||||||
|
path => "/tmp/${archive_name}",
|
||||||
|
source => "${_archive_url}",
|
||||||
|
extract => true,
|
||||||
|
extract_path => $install_path,
|
||||||
|
creates => "${install_path}/${executable}",
|
||||||
|
cleanup => true,
|
||||||
|
require => File[$install_path],
|
||||||
|
user => $user,
|
||||||
|
group => $group,
|
||||||
|
} ->
|
||||||
|
exec { 'move files to correct folder':
|
||||||
|
command => "/usr/bin/mv ${install_path}/Radarr/* ${install_path}",
|
||||||
|
creates => "${install_path}/${executable}",
|
||||||
|
}
|
||||||
|
}
|
||||||
18
manifests/params.pp
Normal file
18
manifests/params.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class radarr::params {
|
||||||
|
$manage_epel = true
|
||||||
|
$install_mono = true
|
||||||
|
$mono_baseurl = 'http://download.mono-project.com/repo/centos/'
|
||||||
|
$mono_gpgkey = 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF'
|
||||||
|
$mono_packages = ['mono-core', 'mono-devel', 'mono-locale-extras']
|
||||||
|
$additional_packages = ['curl', 'mediainfo']
|
||||||
|
$user = 'radarr'
|
||||||
|
$base_path = '/opt/radarr'
|
||||||
|
$install_path = '/opt/radarr/bin'
|
||||||
|
$config_folder = "/home/${user}/.config"
|
||||||
|
$app_folder = "/home/${user}/.config/Radarr"
|
||||||
|
$archive_name = 'Radarr.develop.linux.tar.gz'
|
||||||
|
$archive_url = '/usr/bin/curl -s https://api.github.com/repos/Radarr/Radarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \'"\' -f 4'
|
||||||
|
$executable = 'Radarr.exe'
|
||||||
|
$service_enable = true
|
||||||
|
$service_name = 'radarr'
|
||||||
|
}
|
||||||
21
manifests/service.pp
Normal file
21
manifests/service.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# == Class: 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/systemd.erb'),
|
||||||
|
enable => true,
|
||||||
|
active => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
metadata.json
Normal file
15
metadata.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "rubueno-radarr",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": "rubueno",
|
||||||
|
"summary": "A Puppet implementation of Radarr",
|
||||||
|
"license": "DBAD",
|
||||||
|
"source": "https://github.com/Rubueno/rubueno-radarr",
|
||||||
|
"project_page": "https://github.com/Rubueno/rubueno-radarr",
|
||||||
|
"issues_url": "https://github.com/Rubueno/rubueno-radarr/issues",
|
||||||
|
"dependencies": [
|
||||||
|
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"},
|
||||||
|
{"name":"puppet-archive","version_requirement":">= 1.0.0"}
|
||||||
|
],
|
||||||
|
"data_provider": null
|
||||||
|
}
|
||||||
13
templates/systemd.erb
Normal file
13
templates/systemd.erb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=<%= @service_name %> Daemon
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=<%= @user %>
|
||||||
|
Group=<%= @group %>
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/mono <%= @install_path %>/<%= @executable %> -nobrowser -data <%= @base_path %>
|
||||||
|
|
||||||
|
TimeoutStopSec=20
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Loading…
Reference in New Issue
Block a user