-
Notifications
You must be signed in to change notification settings - Fork 5
/
radarr.yml
136 lines (121 loc) · 4.45 KB
/
radarr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
- hosts: homelab
vars:
application: radarr
docker_network: "{{ networks.pub }}"
handlers:
- name: Restart
community.docker.docker_container:
name: "{{ application }}"
restart: true
comparisons:
'*': ignore
tasks:
- name: Create config folder
ansible.builtin.file:
path: "{{ config_directory }}"
state: directory
owner: "{{ common_user }}"
group: "{{ common_root_group }}"
mode: "0771"
- name: Copy SQL database init script to create log database
ansible.builtin.copy:
content: |
#!/usr/bin/env bash
set -euo pipefail
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE "{{ application }}-log";
GRANT ALL PRIVILEGES ON DATABASE "{{ application }}-log" TO "$POSTGRES_USER";
EOSQL
dest: "{{ config_directory }}/init-log-db.sh"
mode: "0755"
- name: Create postgres container
ansible.builtin.import_role:
name: postgres
vars:
postgres_version: 16
postgres_database: "{{ application }}-main"
postgres_directory_extra:
- "{{ config_directory }}/init-log-db.sh:/docker-entrypoint-initdb.d/init-log-db.sh:ro"
postgres_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
39313963656533633438636530313562363939393261623962343538316535653236623636353563
6634613061353235343736373037323565316238333732330a333166373836653633313366366436
37313938666665396638336136393661363634663562356434656465626566313965656165366534
3865313664613262660a313036633039643530636266336466333161316335663230373361663566
64343163303566656461396630386237346262313662633537386138643534303037356239303363
6233633538623362366461663538663461613838386238323133
- name: Create container
ansible.builtin.include_role:
name: docker_container
vars:
image: lscr.io/linuxserver/radarr:version-5.16.3.9541
volumes:
- "{{ config_directory }}/config:/config"
- "{{ common_directory_storage }}:{{ common_mounted_directory }}"
env:
PUID: "{{ common_user_id | string }}"
PGID: "{{ common_root_group | string }}"
TZ: "{{ common_timezone }}"
traefik:
- port: 7878
auth: page
rule: Host(`{{ application }}.{{ common_tld }}`)
-
name: "{{ application }}-bypass-auth"
port: 7878
rule: Host(`{{ application }}.{{ common_tld }}`) && PathPrefix(`/api/`) && Header(`{{ traefik_bypass_auth_header.key }}`, `{{ traefik_bypass_auth_header.value }}`)
homepage:
group: Favourites
weight: 410
description: "Manage and download movies"
widget:
key: "{{ radarr_api_key }}"
enableQueue: "true"
fields: '["wanted", "movies"]'
healthcheck:
test: "curl -f http://localhost:7878/ || exit 1"
start_period: 5s
interval: 5s
retries: 3
blackbox:
path: /ping
labels:
autoheal: "true"
- name: Wait for config
ansible.builtin.wait_for:
path: "{{ config_directory }}/config/config.xml"
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
changed_when: false
- name: Install lxml
ansible.builtin.apt:
name: python3-lxml
state: present
register: result
until: result is success
retries: 5
delay: 5
- name: Configure config.xml
community.general.xml:
path: "{{ config_directory }}/config/config.xml"
xpath: "/Config/{{ item.key }}"
value: "{{ item.value | string }}"
pretty_print: true
loop: "{{ _radarr_config | dict2items }}"
notify: Restart
vars:
_radarr_config:
ApiKey: "{{ radarr_api_key }}"
LaunchBrowser: "False"
AnalyticsEnabled: "False"
AuthenticationMethod: "External"
# https://wiki.servarr.com/radarr/postgres-setup
PostgresHost: "{{ _postgres_hostname }}"
PostgresPort: "{{ _postgres_port }}"
PostgresMainDb: "{{ _postgres_database }}"
PostgresLogDb: "{{ application }}-log"
PostgresUser: "{{ _postgres_username }}"
PostgresPassword: "{{ _postgres_password }}"