Add radarr package

This commit is contained in:
Joshua Boniface 2019-05-10 18:18:54 -04:00
parent c37305864d
commit ee2c8b1604
5 changed files with 134 additions and 0 deletions

31
package-radarr/README.md Normal file
View File

@ -0,0 +1,31 @@
# package-radarr
This package configures the Radarr Movie download manager on a Debian/Ubuntu system.
# Package variables
## Configurable
These variables should be configured in the host group that imports this role.
### `radarr_version`: The version to use.
* Should be a valid release version.
### `radarr_sha256sum`: The SHA256 sum of the GitHub release binary.
* Must match the artifact for the version specified in `radarr_version`.
## Defaults
These variables should not need to be changed.
### `radarr_user`: The service username.
* Default: `radarr`
### `radarr_uid`: The service user UID.
* Default: `219`
### `radarr_path`: The homedir for the service user and application.
* Default: `/srv/radarr`
### `radarr_url`: The GitHub release artifact URL
* Default: `https://github.com/Radarr/Radarr/releases/download/v{{ radarr_version }}/Radarr.develop.{{ radarr_version }}.linux.tar.gz`

View File

@ -0,0 +1,5 @@
---
- name: restart radarr
service:
name: "radarr"
state: "restarted"

View File

@ -0,0 +1,79 @@
---
- name: install dependency packages
apt:
pkg:
- mono-runtime
- libmono-cil-dev
- libcurl3-nss
- mediainfo
state: latest
- name: add service user
user:
name: "{{ radarr_user }}"
group: "daemon"
system: yes
uid: "{{ radarr_uid }}"
home: "{{ radarr_path }}"
shell: "/usr/sbin/nologin"
state: present
- name: create service directories
file:
dest: "{{ item }}"
state: directory
owner: "{{ radarr_user }}"
group: "daemon"
mode: 0755
with_items:
- "{{ radarr_path }}"
- "{{ radarr_path }}/bin"
- name: download application from GitHub
get_url:
url: "{{ radarr_url }}"
checksum: "sha256:{{ radarr_sha256sum }}"
dest: "{{ radarr_path }}/radarr.{{ radarr_version }}.tgz"
owner: "{{ radarr_user }}"
group: "sudo"
register: download
notify:
- restart radarr
- name: extract application tarball
unarchive:
src: "{{ radarr_path }}/radarr.{{ radarr_version }}.tgz"
dest: "{{ radarr_path }}/bin"
remote_src: yes
when: download.changed
- name: correct archive permissions
file:
owner: "{{ radarr_user }}"
group: "sudo"
mode: "u+rw,g+r"
recurse: yes
dest: "{{ radarr_path }}/bin"
when: download.changed
- name: install systemd unit files
template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
register: systemd_file
with_items:
- radarr.service
- name: reload systemd to apply previous changes
command: "systemctl daemon-reload"
when: systemd_file.changed
notify:
- restart radarr
- name: start and enable systemd units
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- radarr.service

View File

@ -0,0 +1,14 @@
# Radarr service unit file
# {{ ansible_managed }}
[Unit]
Description = Radarr Movie download manager
After = network-online.target
[Service]
Type = simple
User = {{ radarr_user }}
ExecStart = /usr/bin/mono --debug {{ radarr_path }}/bin/Radarr/Radarr.exe -nobrowser
Restart = on-failure
[Install]
WantedBy = multi-user.target

View File

@ -0,0 +1,5 @@
---
radarr_user: "radarr"
radarr_uid: "219"
radarr_path: "/srv/radarr"
radarr_url: "https://github.com/Radarr/Radarr/releases/download/v{{ radarr_version }}/Radarr.develop.{{ radarr_version }}.linux.tar.gz"