From 67789a84301f12dc58ac08957a9c14c0f3afe9d3 Mon Sep 17 00:00:00 2001 From: MrDoobPG <46342172+MrDoobPG@users.noreply.github.com> Date: Fri, 23 Aug 2019 22:41:25 +0200 Subject: [PATCH] Add files via upload --- menu/pgui/templates/_core.yml | 189 ++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 menu/pgui/templates/_core.yml diff --git a/menu/pgui/templates/_core.yml b/menu/pgui/templates/_core.yml new file mode 100644 index 00000000..c84a5204 --- /dev/null +++ b/menu/pgui/templates/_core.yml @@ -0,0 +1,189 @@ +#!/bin/bash +# +# Title: PGBlitz (Reference Title File) +# Author(s): Admin9705 +# URL: https://pgblitz.com - http://github.pgblitz.com +# GNU: General Public License v3.0 +################################################################################ +--- +# RECALL KEY VARIABLES ######################################################### + +- name: 'Register TLD' + shell: 'cat /var/plexguide/tld.program' + register: toplevel + ignore_errors: True + +- name: Register Domain + shell: 'cat /var/plexguide/server.domain' + register: domain + ignore_errors: True + +- name: Register IP + shell: 'cat /var/plexguide/server.ip' + register: ipaddress + ignore_errors: True + +- name: Register Ports + shell: 'cat /var/plexguide/server.ports' + register: ports + ignore_errors: True + +- name: Register HD Path + shell: 'cat /var/plexguide/server.hd.path' + register: path + ignore_errors: True + +- name: Register Auth Path + shell: 'cat /var/plexguide/server.ht' + register: auth + ignore_errors: True + +- name: Register Program Name + shell: 'cat /tmp/program_var' + register: program + ignore_errors: True + +- name: check if user cname file exists + stat: + path: /var/plexguide/{{pgrole}}.cname + register: ucname_check + +- name: Register user cname + shell: 'cat /var/plexguide/{{pgrole}}.cname' + register: ucname + ignore_errors: True + when: ucname_check.stat.exists == true + +- name: Register CName + set_fact: + cname: "" + +- name: Set cname + set_fact: + cname: ",{{ucname.stdout}}.{{domain.stdout}}" + when: ucname_check.stat.exists == true and ucname.stdout != "" + +- name: check if user port file exists + stat: + path: /var/plexguide/{{pgrole}}.port + register: ueport_check + +- name: Register External Port + shell: 'cat /var/plexguide/{{pgrole}}.port' + register: ueport + ignore_errors: True + when: ueport_check.stat.exists == true + +- name: Change extport + set_fact: + extport: "{{ueport.stdout}}" + when: ueport_check.stat.exists and ueport.stdout != "" + +- name: Remove {{pgrole}} Container + docker_container: + name: '{{pgrole}}' + state: absent + ignore_errors: True + +- name: Storing Role Name + shell: "echo '{{pgrole}}' > /tmp/program_var" + ignore_errors: True + + # APPDATA +- name: 'Creating appdata folder if it does not exist.' + shell: 'mkdir -p /opt/appdata/{{pgrole}}' + +- name: 'Setting ownership on appdata' + shell: 'chown 1000:1000 /opt/appdata/{{pgrole}}' + when: '"plex" in pgrole' + +- name: 'Setting permissions on appdata' + shell: 'chmod 775 /opt/appdata/{{pgrole}}' + when: '"plex" in pgrole' + +- name: 'Setting ownership on appdata recursivley (this can take a while!)' + shell: 'chown -R 1000:1000 /opt/appdata/{{pgrole}}' + when: '"plex" not in pgrole' + +- name: 'Setting permissions on appdata recursivley (this can take a while!)' + shell: 'chmod -R 775 /opt/appdata/{{pgrole}}' + when: '"plex" not in pgrole' + +# OVERWRITE IMAGES ############################################################# +- name: Check if Image Variable Exists + stat: + path: '/var/plexguide/image/{{pgrole}}' + register: imagecheck + +- name: 'Transfer Image Variable' + shell: 'cat /var/plexguide/image/{{pgrole}}' + register: imagetemp + when: imagecheck.stat.exists + +- name: 'If Fact Does Not Match - Disable TLD' + set_fact: + image: '{{imagetemp.stdout}}' + when: imagecheck.stat.exists + +# TOP LEVEL DOMAIN INFO SET #################################################### + +- debug: msg="Stored TLD - {{pgrole}} must match {{toplevel.stdout}} for TLD" + +- name: 'If Fact Matches - Enable TLD' + set_fact: + tldset: ',{{domain.stdout}},www.{{domain.stdout}}' + when: 'toplevel.stdout == pgrole' + +- debug: msg="TLDSET is now for {{toplevel.stdout}}" + when: 'toplevel.stdout == pgrole' + +- name: 'If Fact Does Not Match - Disable TLD' + set_fact: + tldset: '' + when: 'not toplevel.stdout == pgrole' + +- debug: msg="TLD does not apply" + when: 'not toplevel.stdout == pgrole' + +# EXTERNAL PORT FOR END BANNER +- name: Export Internal Port + shell: 'echo {{extport}} > /tmp/program_port' + ignore_errors: True + +# FOR AUTHENTICATION +- name: 'Script Execute Part I' + shell: 'bash /opt/pgshield/drop.sh' + +- name: 'Script Execute Part II' + shell: 'cat /var/plexguide/auth.var' + register: oauth + +- name: 'OAuth Exe' + block: + - name: Check if Anti Auth Variable Exists + stat: + path: '/var/plexguide/auth/{{pgrole}}' + register: authcheck + + - name: 'Auth Check 1' + set_fact: + gauth: 'http://oauth:4181' + when: not authcheck.stat.exists + + - name: 'Auth Check 2' + set_fact: + gauth: '' + when: authcheck.stat.exists + + when: oauth.stdout == 'good' + +- name: 'OAuth Exe' + set_fact: + gauth: '' + when: not oauth.stdout == 'good' + +- debug: msg="OAuth - {{oauth.stdout}}" + +##PG-Core + +##PG-Core