-
Notifications
You must be signed in to change notification settings - Fork 6
/
sabnzbd
196 lines (169 loc) · 5.54 KB
/
sabnzbd
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
############# https://github.com/plexguide/PlexGuide.com/graphs/contributors ###
sabnzbd () {
container_reset
# VARIABLES ####################################################################
pgrole="sabnzbd"
port_inside01="8080"
port_outside01="8080"
traefik_extport="8080"
common_fcreate_silent /pg/complete/$pgrole
common_fcreate_silent /pg/incomplete/$pgrole
common_fcreate_silent /pg/complete/$pgrole
common_fcreate_silent /pg/data/$pgrole/watch
container_path /pg /pg
container_path /pg/data/$pgrole /config
container_path /etc/localtime /etc/localtime:ro
container_permissions PUID 1000
container_permissions PGID 1000
common_main /pg/data/sabnzbd/cname.traefik sabnzbd sab_sub
common_main /pg/var/traefik/t.domain NOT-SET sab_domain
# IMAGES EXPORT - 1ST IS DEFAULT ###############################################
cat <<- EOF > "/pg/images/$pgrole.images"
linuxserver/sabnzbd:latest
linuxserver/sabnzbd:unstable
EOF
# YML EXPORT ###################################################################
container_core
cat <<- EOF > "/pg/apps/$pgrole.yml"
$container_header
### ALIGN WITH THE A ################################## START - EXTRAS #########
- name: 'Checking for existing app data'
stat:
path: '/pg/data/$pgrole/sabnzbd.ini'
register: inicheck
####### ALIGN WITH THE A ############################## CORE ###################
$container_start
published_ports:
- '${portcheck_add}${port_outside01}:${port_inside01}'
env:
$container_permissions
labels:
$container_traefik
$container_oddball
$container_ending
### ALIGN WITH THE A ################################## END - EXTRAS ###########
- name: 'Waiting for $pgrole to initialize'
wait_for:
path: '/pg/data/$pgrole/sabnzbd.ini'
state: present
delay: 5
- name: 'Stopping $pgrole'
docker_container:
name: '$pgrole'
state: stopped
- name: Set download_dir when incomplete is undefined
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: download_dir
value: '/pg/incomplete/$pgrole'
state: present
- name: Set complete_dir
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: complete_dir
value: '/pg/complete/$pgrole'
state: present
- name: Set nzb watch location
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: dirscan_dir
value: '/pg/data/$pgrole/watch'
state: present
- name: Set nzb backup location
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: nzb_backup_dir
value: '/pg/data/$sabnzbd'
state: present
- name: set script_dir
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: script_dir
value: scripts
state: present
- name: Set host_whitelist
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: host_whitelist
value: '$sab_sub.$sab_domain,'
state: present
# FIRST TIME CONFIGURATION ###########################################################
- name: 'Configuring $pgrole for first time use'
block:
- name: Set direct_unpack
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: direct_unpack
value: 1
state: present
- name: Set ignore_samples
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: ignore_samples
value: 1
state: present
- name: set unwanted_extensions
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: unwanted_extensions
value: exe, com, bat, sh, iso, m2ts, mt2s
state: present
- name: set cleanup_list
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: cleanup_list
value: nfo, exe, com, bat, txt, doc, xls, xlxs, docx, doc, jpg, jeg, gif, png
state: present
- name: set action_on_unwanted_extensions
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: action_on_unwanted_extensions
value: '2'
state: present
- name: set pause_on_pwrar - aborts encrypted rar rather than pausing
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: pause_on_pwrar
value: '2'
state: present
- name: set new_nzb_on_failure - try a new nzb if it fails
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: new_nzb_on_failure
value: '1'
state: present
- name: set flat_unpack
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: flat_unpack
value: '1'
state: present
- name: set download_free
ini_file:
path: '/pg/data/$pgrole/sabnzbd.ini'
section: misc
option: download_free
value: 25G
state: present
when: not inicheck.stat.exists
- name: 'Restart $pgrole'
docker_container:
name: '$pgrole'
state: started
EOF
}