-
Notifications
You must be signed in to change notification settings - Fork 48
/
traefik.yml
91 lines (80 loc) · 2.45 KB
/
traefik.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/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: True
tasks:
# BASIC TASKS ######################################################
- name: 'Including cron job'
include_tasks: '/pg/traefik/provider.yml'
- name: Register E-Mail
shell: "cat /pg/var/server.email"
register: email
- name: Register Delay Check
shell: "cat /pg/var/server.delaycheck"
register: delaycheck
- name: Register Domain
shell: "cat /pg/var/server.domain"
register: domain
- name: Register Provider
shell: "cat /pg/var/traefik.provider"
register: provider
- name: Remove Traefik
docker_container:
name: traefik
state: absent
- name: Removing Prior Traefik.toml
file:
state: absent
path: /pg/data/traefik/traefik.toml
- name: Create Basic Directories
file: "path={{item}} state=directory mode=0775 owner=1000 group=1000"
with_items:
- /pg/data/traefik
- /pg/data/traefik/acme
- name: Installing Traefik.Toml
template:
src: traefik.toml
dest: /pg/data/traefik/traefik.toml
force: yes
owner: '1000'
group: '1000'
- name: Check acme.json exists
stat:
path: "/pg/data/traefik/acme/acme.json"
register: acme_json
- name: Installing ACME
template:
src: acme.json
dest: /pg/data/traefik/acme/acme.json
force: yes
mode: 0600
owner: '1000'
group: '1000'
when: acme_json.stat.exists == False
# MAIN #####################################################################
- name: Deploy Traefik
docker_container:
name: traefik
image: traefik:1.7
pull: yes
published_ports:
- "443:443"
- "80:80"
env: '{{pg_env}}'
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/localtime:/etc/localtime:ro
- /pg/data/traefik/traefik.toml:/etc/traefik/traefik.toml:ro
- /pg/data/traefik/acme:/etc/traefik/acme
restart_policy: unless-stopped
state: started
networks:
- name: plexguide
aliases:
- traefik