Files
Apps-Community/apps/beets.yml
Admin9705 5bcecca08d update
2019-01-11 12:21:05 -05:00

109 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: 'beets'
intport: '8337'
extport: '8337'
image: 'linuxserver/beets'
# CORE (MANDATORY) ############################################################
- name: 'Including cron job'
include_tasks: '/opt/plexguide/containers/_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}}'
- 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