80 lines
1.7 KiB
YAML
80 lines
1.7 KiB
YAML
---
|
|
- 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
|