#!/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: 'beets' intport: '8337' extport: '8337' image: 'linuxserver/beets' # CORE (MANDATORY) ############################################################ - name: 'Including cron job' include_tasks: '/opt/communityapps/apps/_core.yml' - name: 'Create {{pgrole}} directories' file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000' with_items: - '{{path.stdout}}/downloads/{{pgrole}}' - '{{path.stdout}}/downloads/{{pgrole}}/music' # 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: - '/opt/appdata/{{pgrole}}:/config' - '/etc/localtime:/etc/localtime:ro' - '{{path.stdout}}:{{path.stdout}}' - '/mnt:/mnt' - name: 'Setting PG ENV' set_fact: pg_env: PUID: '1000' PGID: '1000' # MAIN DEPLOYMENT ############################################################# - name: ConfCheck stat: path: '/opt/appdata/{{pgrole}}/config.yaml' register: confcheck - name: 'Configuring {{pgrole}} for first time use' block: - name: 'Deploying {{pgrole}}' docker_container: name: 'beets' 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}}' - name: Automatic Import cron: name: '{{pgrole}} Import' user: 'root' special_time: hourly job: "s'" state: present - name: YAML Creation Hold wait_for: path: '/opt/appdata/{{pgrole}}/config.yaml' state: present - name: Container Stop docker_container: name: '{{pgrole}}' state: stopped - name: File Length Limit lineinfile: path: '/opt/appdata/{{pgrole}}/config.yaml' line: 'max_filename_length: 255' insertafter: per_disc* state: present - name: Contair Start docker_container: name: '{{pgrole}}' state: started when: not confcheck.stat.exists