feat: initial installation role for prowlarr

This commit is contained in:
2026-05-24 17:13:34 +02:00
commit b878ba287d
6 changed files with 190 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.retry

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
# ansible-role-prowlarr
Installs Prowlarr from GitHub releases on Linux. Architecture is auto-detected.
The role is idempotent: re-running only installs if the version has changed.
The service user and group must be created beforehand (e.g. via a users role).
## Requirements
- Ansible >= 2.14
- `sqlite3` package on the target host
## Role Variables
| Variable | Default | Description |
|---|---|---|
| `prowlarr_version` | `""` | Version to install (empty = latest) |
| `prowlarr_user` | `prowlarr` | System user to run Prowlarr |
| `prowlarr_group` | `prowlarr` | System group to run Prowlarr |
| `prowlarr_install_dir` | `/opt/prowlarr` | Binary installation directory |
| `prowlarr_data_dir` | `/var/lib/prowlarr` | Data and config directory |
| `prowlarr_service_enabled` | `true` | Enable service at boot |
| `prowlarr_service_state` | `started` | Service state after installation |
## Example Playbook
```yaml
- hosts: servers
roles:
- role: ansible-role-prowlarr
vars:
prowlarr_user: prowlarr
prowlarr_group: prowlarr
```
## License
MIT

8
defaults/main.yml Normal file
View File

@@ -0,0 +1,8 @@
---
prowlarr_version: ""
prowlarr_user: prowlarr
prowlarr_group: prowlarr
prowlarr_install_dir: /opt/prowlarr
prowlarr_data_dir: /var/lib/prowlarr
prowlarr_service_enabled: true
prowlarr_service_state: started

1
handlers/main.yml Normal file
View File

@@ -0,0 +1 @@
---

15
meta/main.yml Normal file
View File

@@ -0,0 +1,15 @@
---
galaxy_info:
author: mathieu
description: Install Prowlarr via binary on Linux
license: MIT
min_ansible_version: "2.14"
platforms:
- name: Debian
versions: [bullseye, bookworm]
- name: Ubuntu
versions: [focal, jammy, noble]
- name: EL
versions: ["8", "9"]
galaxy_tags: [prowlarr, media, arr]
dependencies: []

127
tasks/main.yml Normal file
View File

@@ -0,0 +1,127 @@
---
- name: Install prerequisites
ansible.builtin.package:
name:
- curl
- sqlite3
state: present
become: true
- name: Set architecture fact
ansible.builtin.set_fact:
_prowlarr_arch: "{{ {'x86_64': 'x64', 'aarch64': 'arm64', 'armv7l': 'arm'}.get(ansible_architecture, 'x64') }}"
- name: Get Prowlarr release info from GitHub
ansible.builtin.uri:
url: >-
{{ 'https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest'
if prowlarr_version == ''
else 'https://api.github.com/repos/Prowlarr/Prowlarr/releases/tags/v' + prowlarr_version }}
headers:
Accept: "application/vnd.github.v3+json"
return_content: true
register: _prowlarr_release
- name: Set version and download URL facts
ansible.builtin.set_fact:
_prowlarr_version_tag: "{{ _prowlarr_release.json.tag_name }}"
_prowlarr_download_url: >-
{{ _prowlarr_release.json.assets
| selectattr('name', 'search', 'linux-core-' + _prowlarr_arch)
| map(attribute='browser_download_url')
| first }}
- name: Read installed version
ansible.builtin.slurp:
src: "{{ prowlarr_install_dir }}/.version"
register: _prowlarr_installed_raw
ignore_errors: true
become: true
- name: Set installed version fact
ansible.builtin.set_fact:
_prowlarr_installed_version: >-
{{ (_prowlarr_installed_raw.content | b64decode | trim)
if _prowlarr_installed_raw is not failed else '' }}
- name: Install or upgrade Prowlarr
when: _prowlarr_installed_version != _prowlarr_version_tag
block:
- name: Download Prowlarr archive
ansible.builtin.get_url:
url: "{{ _prowlarr_download_url }}"
dest: /tmp/prowlarr.tar.gz
mode: '0644'
- name: Create Prowlarr installation directory
ansible.builtin.file:
path: "{{ prowlarr_install_dir }}"
state: directory
owner: "{{ prowlarr_user }}"
group: "{{ prowlarr_group }}"
mode: '0755'
become: true
- name: Extract Prowlarr archive
ansible.builtin.unarchive:
src: /tmp/prowlarr.tar.gz
dest: "{{ prowlarr_install_dir }}"
remote_src: true
extra_opts: [--strip-components=1]
owner: "{{ prowlarr_user }}"
group: "{{ prowlarr_group }}"
become: true
- name: Write installed version file
ansible.builtin.copy:
content: "{{ _prowlarr_version_tag }}"
dest: "{{ prowlarr_install_dir }}/.version"
owner: "{{ prowlarr_user }}"
group: "{{ prowlarr_group }}"
mode: '0644'
become: true
- name: Remove downloaded archive
ansible.builtin.file:
path: /tmp/prowlarr.tar.gz
state: absent
- name: Create Prowlarr data directory
ansible.builtin.file:
path: "{{ prowlarr_data_dir }}"
state: directory
owner: "{{ prowlarr_user }}"
group: "{{ prowlarr_group }}"
mode: '0750'
become: true
- name: Create Prowlarr systemd service
ansible.builtin.copy:
content: |
[Unit]
Description=Prowlarr
After=syslog.target network.target
[Service]
SyslogIdentifier=prowlarr
ExecStart={{ prowlarr_install_dir }}/Prowlarr -nobrowser -data={{ prowlarr_data_dir }}
TimeoutStopSec=20
KillMode=process
Restart=on-failure
User={{ prowlarr_user }}
Group={{ prowlarr_group }}
UMask=0002
[Install]
WantedBy=multi-user.target
dest: /etc/systemd/system/prowlarr.service
mode: '0644'
become: true
- name: Enable and start Prowlarr service
ansible.builtin.systemd:
name: prowlarr
enabled: "{{ prowlarr_service_enabled }}"
state: "{{ prowlarr_service_state }}"
daemon_reload: true
become: true