X Tutup
Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 7f2e853

Browse files
committed
Plex: Only stop/start plex container once during extra tasks.
1 parent 3463334 commit 7f2e853

File tree

8 files changed

+63
-28
lines changed

8 files changed

+63
-28
lines changed

roles/plex/tasks/main.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@
168168
restart_policy: unless-stopped
169169
state: started
170170

171-
- name: "Wait 15 seconds"
172-
wait_for:
173-
timeout: 15
174-
175171
# Sometimes docker will set transcodes folder to root after a restore.
176172
- name: "Ensure transcodes folder has the correct permissions"
177173
file:
@@ -181,24 +177,6 @@
181177
mode: 0775
182178
recurse: yes
183179

184-
- name: "Install Trakt.tv Plugin"
185-
import_role:
186-
name: trakttv-plugin
187-
188-
- name: "Install Sub-Zero Plugin"
189-
import_role:
190-
name: sub-zero-plugin
191-
192-
- name: "Install WebTools Plugin"
193-
import_role:
194-
name: webtools-plugin
195-
196-
- name: "Forced Automatic Quality Settings"
197-
import_tasks: "subtasks/settings/forced_quality.yml"
198-
tags: plex_forced_quality
199-
when: (not continuous_integration)
200-
201-
- name: "DB Cache Size Settings"
202-
import_tasks: "subtasks/settings/db_cache_size.yml"
203-
tags: plex_db_cache_size
180+
- name: Extra Tasks
181+
import_tasks: "subtasks/extra.yml"
204182
when: (not continuous_integration)

roles/plex/tasks/subtasks/claim_server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##########################################################################
2-
# Title: Plex: Claim Server #
2+
# Title: Cloudbox: Plex | Claim Server #
33
# Author(s): desimaniac #
44
# URL: https://github.com/cloudbox/cloudbox #
55
# -- #
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
##########################################################################
2+
# Title: Cloudbox: Plex | Extra Tasks #
3+
# Author(s): desimaniac #
4+
# URL: https://github.com/cloudbox/cloudbox #
5+
# -- #
6+
# Part of the Cloudbox project: https://cloudbox.works #
7+
##########################################################################
8+
# GNU General Public License v3.0 #
9+
##########################################################################
10+
---
11+
- name: Wait for 'Preferences.xml' to be created by Plex
12+
wait_for:
13+
path: "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml"
14+
state: present
15+
16+
- name: Wait for Plex DB to be created
17+
wait_for:
18+
path: "/opt/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
19+
state: present
20+
21+
- name: Stop Plex Container
22+
docker_container:
23+
name: plex
24+
state: stopped
25+
26+
- name: "DB Cache Size Settings"
27+
import_tasks: "subtasks/settings/db_cache_size.yml"
28+
tags: plex_db_cache_size
29+
30+
- name: "Forced Automatic Quality Settings"
31+
import_tasks: "subtasks/settings/forced_quality.yml"
32+
tags: plex_forced_quality
33+
34+
- name: "Install Trakt.tv Plugin"
35+
import_role:
36+
name: trakttv-plugin
37+
38+
- name: "Install Sub-Zero Plugin"
39+
import_role:
40+
name: sub-zero-plugin
41+
42+
- name: "Install WebTools Plugin"
43+
import_role:
44+
name: webtools-plugin
45+
46+
- name: Start Plex Container
47+
docker_container:
48+
name: plex
49+
state: started

roles/plex/tasks/subtasks/settings/db_cache_size.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##########################################################################
2-
# Title: Plex: DB Cache Size Settings #
2+
# Title: Cloudbox: Plex | DB Cache Size Settings #
33
# Author(s): desimaniac #
44
# URL: https://github.com/cloudbox/cloudbox #
55
# -- #
@@ -50,6 +50,7 @@
5050
docker_container:
5151
name: plex
5252
state: stopped
53+
when: ('plex_db_cache_size' in ansible_run_tags)
5354

5455
- name: Display Desired Plex DB Cache Size
5556
debug:
@@ -78,5 +79,6 @@
7879
docker_container:
7980
name: plex
8081
state: started
82+
when: ('plex_db_cache_size' in ansible_run_tags)
8183

8284
when: ( current_db_cache_size.stdout | int ) != ( desired_db_cache_size | regex_replace(',', '') | int )

roles/plex/tasks/subtasks/settings/forced_quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##########################################################################
2-
# Title: Plex: Forced Automatic Quality Settings #
2+
# Title: Cloudbox: Plex | Forced Automatic Quality Settings #
33
# Author(s): desimaniac #
44
# URL: https://github.com/cloudbox/cloudbox #
55
# -- #
@@ -51,4 +51,4 @@
5151
name: plex
5252
state: started
5353
restart: yes
54-
when: x.changed or y.changed
54+
when: ('plex_forced_quality' in ansible_run_tags) and (x.changed or y.changed)

roles/sub-zero-plugin/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
docker_container:
5454
name: plex
5555
state: stopped
56+
when: ('sub-zero-plugin' in ansible_run_tags) or ('reinstall-sub-zero-plugin' in ansible_run_tags)
5657

5758
- name: Remove outdated Sub-Zero Plugin
5859
file:
@@ -101,6 +102,7 @@
101102
docker_container:
102103
name: plex
103104
state: started
105+
when: ('sub-zero-plugin' in ansible_run_tags) or ('reinstall-sub-zero-plugin' in ansible_run_tags)
104106

105107
when: (not subzero_bundle.stat.exists) or ((subzero_bundle.stat.exists) and (subzero_outdated)) or ('reinstall-sub-zero-plugin' in ansible_run_tags)
106108

roles/trakttv-plugin/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
docker_container:
1313
name: plex
1414
state: stopped
15+
when: ('trakttv-plugin' in ansible_run_tags)
1516

1617
- name: Remove Previous Trakt.tv Plugin
1718
file:
@@ -62,3 +63,4 @@
6263
docker_container:
6364
name: plex
6465
state: started
66+
when: ('trakttv-plugin' in ansible_run_tags)

roles/webtools-plugin/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
docker_container:
4747
name: plex
4848
state: stopped
49+
when: ('webtools-plugin' in ansible_run_tags) or ('reinstall-webtools-plugin' in ansible_run_tags)
4950

5051
- name: Remove outdated WebTools Plugin
5152
file:
@@ -88,6 +89,7 @@
8889
docker_container:
8990
name: plex
9091
state: started
92+
when: ('webtools-plugin' in ansible_run_tags) or ('reinstall-webtools-plugin' in ansible_run_tags)
9193

9294
when: (not webtools_bundle.stat.exists) or ((webtools_bundle.stat.exists) and (webtools_outdated)) or ('reinstall-webtools-plugin' in ansible_run_tags)
9395

0 commit comments

Comments
 (0)
X Tutup