mirror of
https://github.com/mtan93/Apps-Community.git
synced 2026-03-08 05:31:59 +00:00
add _core files
This commit is contained in:
151
apps/_core.yml
Normal file
151
apps/_core.yml
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Title: PlexGuide (Reference Title File)
|
||||||
|
# Author(s): Admin9705
|
||||||
|
# URL: https://plexguide.com - http://github.plexguide.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 incomplete Path
|
||||||
|
shell: 'cat /var/plexguide/server.incomplete.path'
|
||||||
|
register: incomplete
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Register Auth Path
|
||||||
|
shell: 'cat /var/plexguide/server.ht'
|
||||||
|
register: auth
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- 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}}'
|
||||||
|
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/plexguide/menu/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}}"
|
||||||
32
apps/_downloaders.yml
Normal file
32
apps/_downloaders.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
- name: Creating download paths
|
||||||
|
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000'
|
||||||
|
with_items:
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}'
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}/tv'
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}/movies'
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}/music'
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}/ebooks'
|
||||||
|
- '{{path.stdout}}/downloads/{{pgrole}}/abooks'
|
||||||
|
|
||||||
|
- name: Creating incomplete paths
|
||||||
|
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000'
|
||||||
|
with_items:
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}'
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}/tv'
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}/movies'
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}/music'
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}/ebooks'
|
||||||
|
- '{{path.stdout}}/incomplete/{{pgrole}}/abooks'
|
||||||
|
when: incomplete.stdout | length == 0
|
||||||
|
|
||||||
|
- name: Creating incomplete paths
|
||||||
|
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000'
|
||||||
|
with_items:
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}'
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}/tv'
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}/movies'
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}/music'
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}/ebooks'
|
||||||
|
- '{{incomplete.stdout}}/{{pgrole}}/abooks'
|
||||||
|
when: incomplete.stdout | length > 0
|
||||||
|
ignore_errors: yes
|
||||||
21
apps/_plugins.yml
Normal file
21
apps/_plugins.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
- name: Creating scripts and plugins paths
|
||||||
|
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000'
|
||||||
|
with_items:
|
||||||
|
- '/opt/appdata/{{pgrole}}/scripts'
|
||||||
|
- '/opt/appdata/{{pgrole}}/plugins'
|
||||||
|
|
||||||
|
- name: 'Check if Templates Exist for {{pgrole}}'
|
||||||
|
stat:
|
||||||
|
path: './templates/{{pgrole}}'
|
||||||
|
register: copycheck
|
||||||
|
|
||||||
|
- name: 'Copying Scripts & Plugins'
|
||||||
|
copy:
|
||||||
|
src: ./templates/{{pgrole}}
|
||||||
|
dest: /opt/appdata
|
||||||
|
directory_mode: yes
|
||||||
|
force: yes
|
||||||
|
owner: 1000
|
||||||
|
group: 1000
|
||||||
|
mode: 0755
|
||||||
|
when: copycheck.stat.exists
|
||||||
Reference in New Issue
Block a user