mirror of
https://github.com/mtan93/Apps-Community.git
synced 2026-03-08 05:31:59 +00:00
98 lines
3.2 KiB
Bash
98 lines
3.2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Title: PlexGuide (Reference Title File)
|
|
# Author(s): Admin9705
|
|
# URL: https://plexguide.com - http://github.plexguide.com
|
|
# GNU: General Public License v3.0
|
|
################################################################################
|
|
---
|
|
- hosts: localhost
|
|
gather_facts: false
|
|
tasks:
|
|
# FACTS #######################################################################
|
|
- name: 'Set Known Facts'
|
|
set_fact:
|
|
pgrole: 'syncthing'
|
|
intport: '8384'
|
|
extport: '8384'
|
|
intport2: '22000'
|
|
extport2: '22000'
|
|
intport3: '21027'
|
|
extport3: '21027'
|
|
image: 'linuxserver/syncthing'
|
|
|
|
# CORE (MANDATORY) ############################################################
|
|
- name: 'Including cron job'
|
|
include_tasks: '/opt/communityapps/apps/_core.yml'
|
|
|
|
# EXTRA FOR RUTORRENT #########################################################
|
|
- name: 'Create {{pgrole}} script directories'
|
|
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000 recurse=yes'
|
|
with_items:
|
|
- '/opt/appdata/{{pgrole}}'
|
|
- '/opt/appdata/{{pgrole}}/sync'
|
|
- '/opt/appdata/{{pgrole}}/config'
|
|
|
|
# LABELS ######################################################################
|
|
- name: 'Adding Traefik'
|
|
set_fact:
|
|
pg_labels:
|
|
traefik.enable: 'true'
|
|
traefik.port: '{{intport}}'
|
|
traefik.frontend.auth.forward.address: '{{gauth}}'
|
|
traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'
|
|
|
|
- name: 'Setting PG Volumes'
|
|
set_fact:
|
|
pg_volumes:
|
|
- '/opt/appdata/{{pgrole}}/config:/config'
|
|
- '/opt/appdata/{{pgrole}}/sync:/sync'
|
|
- '/mnt:/mnt'
|
|
- '{{path.stdout}}:{{path.stdout}}'
|
|
|
|
- name: 'Setting PG ENV'
|
|
set_fact:
|
|
pg_env:
|
|
PUID: 1000
|
|
PGID: 1000
|
|
|
|
# MAIN DEPLOYMENT #############################################################
|
|
- name: xmlcheck
|
|
stat:
|
|
path: '/opt/appdata/{{pgrole}}/config/config.xml'
|
|
register: xmlcheck
|
|
|
|
- name: 'Deploying {{pgrole}}'
|
|
docker_container:
|
|
name: '{{pgrole}}'
|
|
image: '{{image}}'
|
|
pull: yes
|
|
published_ports:
|
|
- '{{ports.stdout}}{{extport}}:{{intport}}'
|
|
- '{{ports.stdout}}{{extport2}}:{{intport2}}'
|
|
- '{{ports.stdout}}{{extport3}}:{{intport3}}'
|
|
volumes: '{{pg_volumes}}'
|
|
env: '{{pg_env}}'
|
|
restart_policy: unless-stopped
|
|
networks:
|
|
- name: plexguide
|
|
aliases:
|
|
- '{{pgrole}}'
|
|
state: started
|
|
labels: '{{pg_labels}}'
|
|
|
|
# ENDING TASK FOR RUTORRENT ####################################################
|
|
- name: 'Configuring {{pgrole}} for first time use'
|
|
block:
|
|
- name: 'Wait 10 Seconds'
|
|
wait_for:
|
|
timeout: 10
|
|
|
|
- name: Replace default sync path in config file
|
|
replace:
|
|
path: /opt/appdata/{{pgrole}}/config/config.xml
|
|
regexp: <defaultFolderPath>~</defaultFolderPath>
|
|
replace: '<defaultFolderPath>/sync</defaultFolderPath>'
|
|
|
|
when: not xmlcheck.stat.exists
|