-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
# | ||
# Title: PGBlitz (Reference Title File) | ||
# Author(s): Admin9705 | ||
# URL: https://pgblitz.com - http://github.pgblitz.com | ||
# GNU: General Public License v3.0 | ||
################################################################################ | ||
--- | ||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Check Preferences.xml exists | ||
stat: | ||
path: '/pg/data/plex/database/Library/Application Support/Plex Media Server/Preferences.xml' | ||
register: plex_prefs | ||
|
||
############### This is needed because on a fresh installaions the value is missing and is defaulted to 1 Security perfered | ||
- name: secureConnections is missing | ||
xml: | ||
path: '/opt/appdata/plex/database/Library/Application Support/Plex Media Server/Preferences.xml' | ||
xpath: /Preferences/@secureConnections | ||
count: yes | ||
register: secure_hits | ||
when: | ||
- plex_prefs.stat.exists | ||
|
||
############### This is needed because on a fresh installaions the value is missing and is defaulted to 1 Security perfered | ||
- name: Add secureConnections if missing | ||
xml: | ||
path: '/pg/data/plex/database/Library/Application Support/Plex Media Server/Preferences.xml' | ||
xpath: /Preferences | ||
attribute: secureConnections | ||
value: '1' | ||
when: | ||
- plex_prefs.stat.exists | ||
- secure_hits.count == 0 | ||
|
||
- name: Read Preferences.xml | ||
xml: | ||
path: '/pg/data/plex/database/Library/Application Support/Plex Media Server/Preferences.xml' | ||
xpath: /Preferences | ||
content: attribute | ||
register: plex_pref_content | ||
when: plex_prefs.stat.exists | ||
|
||
- name: Add https to default_label if secureConnection != 2 | ||
set_fact: | ||
default_labels: "{{default_labels | combine( {'traefik.protocol': 'https'} )}}" | ||
when: | ||
- plex_prefs.stat.exists | ||
- plex_pref_content.matches[0]['Preferences']['secureConnections'] | ||
|
||
- name: Read customConnections | ||
set_fact: | ||
customConnections: "{{plex_pref_content.matches[0]['Preferences']['customConnections']}}" | ||
when: | ||
- plex_prefs.stat.exists | ||
- plex_pref_content.matches[0]['Preferences']['customConnections'] is defined | ||
|
||
- name: customConnections missing | ||
set_fact: | ||
customConnections: 'http://{{ipaddress.stdout}}:32400, http://plex.{{domain}}:32400' | ||
when: | ||
- plex_prefs.stat.exists == False | ||
|
||
- name: 'Get Plex Custom URL' | ||
shell: 'echo https://plex.{{domain}}:443,http://plex.{{domain}}:80' | ||
register: plex_url | ||
when: servertype.stdout == "remote" | ||
|
||
- debug: msg="Your plex_url is {{ plex_url.stdout }}" | ||
when: servertype.stdout == "remote" | ||
|
||
- set_fact: | ||
plex_advert_ip: 'http://{{ipaddress.stdout}}:32400' | ||
when: servertype.stdout == "remote" | ||
|
||
- set_fact: | ||
plex_advert_ip: '{{plex_url.stdout}}' | ||
when: servertype.stdout == "remote" | ||
|
||
- debug: msg="plex_advert_ip is {{plex_advert_ip}}" | ||
when: servertype.stdout == "remote" |