#!/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: 'nzbthrottle' intport: '0' extport: '0' image: 'daghaian/nzbthrottle' # CORE (MANDATORY) ############################################################ - name: 'Including cron job' include_tasks: '/opt/plexguide/containers/_core.yml' - name: Checking {{pgrole}}'s json existance stat: path: '/opt/plexguide/containers/templates/{{pgrole}}/config.json' register: jsoncheck - name: 'Copying file for {{pgrole}}' copy: src: /opt/plexguide/containers/templates/{{pgrole}}.json dest: /opt/appdata/{{pgrole}}/{{pgrole}}json directory_mode: yes force: yes owner: 1000 group: 1000 mode: 0755 when: not nzbthrottle.stat.exists # LABELS ###################################################################### - name: 'Adding Traefik' set_fact: pg_labels: traefik.frontend.auth.forward.address: '{{gauth}}' traefik.enable: 'true' traefik.port: '{{intport}}' traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}' - name: 'Setting PG Volumes' set_fact: pg_volumes: - '/etc/localtime:/etc/localtime:ro' - '/opt/appdata/{{pgrole}}/config.json:/{{pgrole}}/config.json:ro' - name: 'Setting PG ENV' set_fact: pg_env: PUID: 1000 PGID: 1000 # MAIN DEPLOYMENT ############################################################# - name: 'Deploying {{pgrole}}' docker_container: name: '{{pgrole}}' image: '{{image}}' pull: yes published_ports: - '{{ports.stdout}}{{extport}}:{{intport}}' volumes: '{{pg_volumes}}' env: '{{pg_env}}' restart_policy: unless-stopped networks: - name: plexguide aliases: - '{{pgrole}}' state: started labels: '{{pg_labels}}'