Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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:
- # FACTS #######################################################################
- - name: 'Set Known Facts'
- set_fact:
- pgrole: 'jellyfin'
- intport: '8096'
- extport: '9096'
- image: 'jellyfin/jellyfin:latest'
- # CORE (MANDATORY) ############################################################
- - name: 'Including cron job'
- include_tasks: '/opt/coreapps/apps/_core.yml'
- - name: 'XML Check'
- stat:
- path: /opt/appdata/{{pgrole}}/config/system.xml
- register: xmlcheck
- # LABELS ######################################################################
- - name: 'Adding Traefik'
- set_fact:
- pg_labels:
- traefik.enable: 'false'
- traefik.port: '{{intport}}'
- traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}}{{tldset}}{{cname}}'
- traefik.frontend.headers.SSLHost: '{{domain.stdout}}'
- traefik.frontend.headers.SSLRedirect: 'true'
- traefik.frontend.headers.STSIncludeSubdomains: 'true'
- traefik.frontend.headers.STSPreload: 'true'
- traefik.frontend.headers.STSSeconds: '315360000'
- traefik.frontend.headers.browserXSSFilter: 'true'
- traefik.frontend.headers.contentTypeNosniff: 'true'
- traefik.frontend.headers.customResponseHeaders: 'X-Robots-Tag:noindex,nofollow,nosnippet,noarchive,notranslate,noimageindex'
- traefik.frontend.headers.forceSTSHeader: 'true'
- - name: 'Setting PG Volumes'
- set_fact:
- pg_volumes:
- - '/etc/localtime:/etc/localtime:ro'
- - '{{path.stdout}}:{{path.stdout}}'
- - '/mnt:/mnt'
- - '/opt/appdata/{{pgrole}}:/config'
- - '/opt/transcodes:/transcode'
- - '/var/run/docker.sock:/var/run/docker.sock'
- - name: 'Setting PG ENV'
- set_fact:
- pg_env:
- GIDLIST: '1000'
- PUID: '1000'
- PGID: '1000'
- # MAIN DEPLOYMENT #############################################################
- - name: 'Check'
- stat:
- path: '/dev/dri'
- register: dev_dri
- - name: 'Deploying {{pgrole}}'
- docker_container:
- name: '{{pgrole}}'
- image: '{{image}}'
- pull: yes
- user: 1000:1000
- devices: "{{ '/dev/dri:/dev/dri' if dev_dri.stat.exists == True | default(false) else omit }}"
- volumes: '{{pg_volumes}}'
- env: '{{pg_env}}'
- network_mode: 'host'
- state: started
- labels: '{{pg_labels}}'
- # FIRST TIME CONFIGURATION ###########################################################
- - name: 'Configuring {{pgrole}} for first time use'
- block:
- - name: 'Pending XML Generation'
- wait_for:
- path: '/opt/appdata/{{pgrole}}/config/system.xml'
- state: present
- - name: 'Wait 5 Seconds'
- wait_for:
- timeout: 5
- - name: 'Stop {{pgrole}}'
- docker_container:
- name: '{{pgrole}}'
- state: stopped
- - name: 'Turn Off Reporting'
- xml:
- path: '/opt/appdata/{{pgrole}}/config/system.xml'
- xpath: /ServerConfiguration/EnableAnonymousUsageReporting
- value: 'false'
- - name: 'Restart {{pgrole}}'
- docker_container:
- name: '{{pgrole}}'
- state: started
- when: not xmlcheck.stat.exists
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement