Skip to content

Commit

Permalink
refactor download folders and plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Baker committed Jan 28, 2019
1 parent c9771d6 commit f4171e3
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 63 deletions.
27 changes: 2 additions & 25 deletions containers/_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,11 @@
shell: "echo '{{pgrole}}' > /tmp/program_var"
ignore_errors: True

# PLUGINS #######################################################################
- 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

- name: 'Setting ownership on appdata'
shell: 'chown -R 1000:1000 /opt/appdata/{{pgrole}}'
shell: 'chown 1000:1000 /opt/appdata/{{pgrole}}'

- name: 'Setting permissions on appdata'
shell: 'chmod -R 775 /opt/appdata/{{pgrole}}'
shell: 'chmod 775 /opt/appdata/{{pgrole}}'

# OVERWRITE IMAGES #############################################################
- name: Check if Image Variable Exists
Expand Down
32 changes: 32 additions & 0 deletions containers/_downloaders.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 13 additions & 34 deletions containers/_folders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,29 @@
- '{{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


- name: 'Moving downloads to new location'
command: 'mv {{path.stdout}}/incomplete/{{pgrole}}/* {{path.stdout}}/downloads/{{pgrole}}/'
when: incomplete.stdout | length == 0
ignore_errors: yes


# MIGRATIONS (REMOVE SECTION ON MARCH 1st) #############################################################
- name: 'Check for old volumes'
stat:
path: '{{path.stdout}}/sab'
register: oldcheck

- name: 'Migrations'
block:
- name: 'Moving downloads to new location'
command: 'mv {{path.stdout}}/sab/downloads/complete/* {{path.stdout}}/downloads/{{pgrole}}/'

- name: 'Moving incomplete downloads to new location'
command: 'mv {{path.stdout}}/sab/downloads/incomplete/* {{path.stdout}}/incomplete/{{pgrole}}/'

- name: 'Setting owner on downloads'
shell: 'chown -R 1000:1000 {{path.stdout}}/downloads/{{pgrole}}'

- name: 'Setting 775 on downloads'
shell: 'chmod -R 775 {{path.stdout}}/downloads/{{pgrole}}'

# - name: Remove old download directory
# file:
# state: absent
# path: '{{path.stdout}}/sab'
when: oldcheck.stat.exists
ignore_errors: yes
21 changes: 21 additions & 0 deletions containers/_plugins.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions menu/pgcloner/pgclone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ echo 'PlexGuide-PGClone' > /var/plexguide/pgcloner.projectname
echo 'v8.3' > /var/plexguide/pgcloner.projectversion

#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
echo "💬 PG Clone for PlexGuide serves as a reverse proxy that enables a user
to mass obtain https (secure) certificates for all their containers! Users
may also enable a container to operate at the Top Level Domain!" > /var/plexguide/pgcloner.info
echo "💬 PG Clone for PlexGuide serves as rclone mounts + mergerfs union" > /var/plexguide/pgcloner.info
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

### START PROCESS
Expand Down
3 changes: 2 additions & 1 deletion menu/pgcloner/traefik.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ echo 'PlexGuide-Traefik' > /var/plexguide/pgcloner.projectname
echo 'v8' > /var/plexguide/pgcloner.projectversion

#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
echo "💬 Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy." > /var/plexguide/pgcloner.info
echo "💬 Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. It serves as a reverse proxy that enables a user \
to mass obtain https (secure) certificates for all their containers!" > /var/plexguide/pgcloner.info
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

### START PROCESS
Expand Down

0 comments on commit f4171e3

Please sign in to comment.