-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
104 lines (95 loc) · 2.93 KB
/
playbook.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
92
93
94
95
96
97
98
99
100
101
102
103
104
- name: "Setup the VM"
hosts: all
gather_facts: true
roles:
- role: roles/setup
- name: "External Docker network"
hosts: all
gather_facts: false
tags:
- traefik
- mastodon
- mastodon.setup
- mastodon.setup.docker-network
vars_files:
- roles/mastodon/vars/mastodon-vars.yml
tasks:
- community.docker.docker_network:
name: "{{ mastodon_docker_external_network_name }}"
- name: "Setup Traefik"
hosts: all
gather_facts: false
tags:
- traefik
roles:
- epfl_si.traefik.traefik
vars_files:
- versions.yml # For traefik_docker_image
- roles/mastodon/vars/mastodon-vars.yml # For mastodon_web_container_name + mastodon_docker_external_network_name
vars:
traefik_root_location: /srv/traefik
traefik_docker_networks:
- name: "{{ mastodon_docker_external_network_name }}"
- name: "{{ mastodon_docker_internal_network_name }}" # Metrics
traefik_use_acme_prod_ca: true
traefik_external_http_port: 80
traefik_debug: false
tasks:
- epfl_si.traefik.dynamic_config:
name: mastodon
content: |
http:
services:
mastodon:
loadBalancer:
servers:
- url: http://{{ mastodon_web_container_name }}:3000
routers:
mastodon:
rule: Host(`{{ inventory_hostname }}`)
service: mastodon
tls:
certResolver: letsencrypt
middlewares: {{ "[ 'test-auth' ]" if (enable_basic_auth is defined and enable_basic_auth) else '[]' }}
middlewares:
test-auth:
basicAuth:
users:
- "{{ _secrets.epfl_account_basic_auth }}"
- epfl_si.traefik.dynamic_config:
name: prometheus
content: |
http:
services:
prometheus:
loadBalancer:
servers:
- url: http://prometheus:9090
routers:
# Serves prometheus on https://{{ inventory_hostname }}/prometheus/
prometheus:
rule: Host(`{{ inventory_hostname }}`) && (PathPrefix(`/prometheus/`) || Header(`Referer`, `https://{{ inventory_hostname }}/prometheus/graph`))
service: prometheus
tls: true
middlewares:
- prometheus-strip-prefix
- prometheus-ui-auth
middlewares:
prometheus-strip-prefix:
stripPrefix:
prefixes:
- "/prometheus"
prometheus-ui-auth:
basicAuth:
users:
- "{{ _secrets.epfl_account_basic_auth }}"
- name: "Setup Mastodon"
hosts: all
gather_facts: false
roles:
- role: roles/mastodon
- name: "Setup monitoring"
hosts: all
gather_facts: false
roles:
- role: roles/monitoring