Skip to content

Commit c032a68

Browse files
committed
Split for WF setups
For the world finals we both test with an online and an onprem instance. We sometimes even manage an online server for the bigger contests together with a server which has no internet access. This also demonstrates to others using this how to setup something like even if we always only use 1 group on the location.
1 parent 254e46e commit c032a68

File tree

10 files changed

+79
-47
lines changed

10 files changed

+79
-47
lines changed

provision-contest/ansible/domserver.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- python3-netaddr
1414

1515
- name: Setup domserver
16-
hosts: domserver
16+
hosts: domserver,online-domserver
1717
vars:
1818
host_type: domserver
1919
become: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../onprem/all.yml.example
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../onprem/secret.yml.example
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/secret.yml
2+
/all.yml

provision-contest/ansible/hosts.example

+22
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ ansible_python_interpreter=/usr/bin/python3
55
# When moving clients for ad-hoc actions:
66
# move them to their own group to keep hosts files on deployed machines in sync.
77

8+
[onprem:children]
9+
domserver
10+
judgehost
11+
cds
12+
grafana
13+
admin
14+
presclient
15+
presadmin
16+
scoreboard
17+
mgmt
18+
autoanalyst
19+
20+
[online:children]
21+
online-domserver
22+
online-judgehost
23+
824
[domserver]
925
domjudge-primary ansible_host=10.3.3.216 KEEPALIVED_PRIORITY=100 EFI_ORDER='0\,1\,3\,4'
1026
domjudge-backup ansible_host=10.3.3.217 KEEPALIVED_PRIORITY=99 EFI_ORDER='0\,1\,3\,4'
@@ -63,3 +79,9 @@ domjudge-scoreboard ansible_host=10.2.2.229
6379
domjudge-mgmg ansible_host=10.3.3.223
6480

6581
[autoanalyst]
82+
83+
[online-domserver]
84+
online-domserver ansible_host=192.168.255.255
85+
86+
[online-judgehost]
87+
online-judgehost1 ansible_host=192.168.255.255

provision-contest/ansible/judgehost.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This playbook installs the DOMjudge judgehosts
33

44
- name: Setup judgehost
5-
hosts: judgehost
5+
hosts: judgehost,online-judgehost
66
strategy: free
77
vars:
88
host_type: judgehost

provision-contest/ansible/roles/grafana/templates/prometheus.yml.j2

+51-45
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,86 @@ scrape_configs:
99
- job_name: 'prometheus'
1010
static_configs:
1111
- targets: ['localhost:9090']
12-
- job_name: 'db'
12+
{% for group_prefix in GROUP_PREFIXES %}
13+
{% if groups[group_prefix+"judgehost"][0] is defined %}
14+
- job_name: node_judgehost
1315
basic_auth:
1416
username: "prometheus"
15-
password: "{{ PROMETHEUS_PASS }}"
17+
password: "{{ hostvars[groups[group_prefix+"judgehost"][0]]['PROMETHEUS_PASS'] }}"
1618
tls_config:
1719
insecure_skip_verify: true
1820
scheme: https
1921
static_configs:
2022
- targets:
21-
{% for host in groups["domserver"] %}
22-
- {{ hostvars[host].ansible_host }}:9104
23+
{% for host in groups[group_prefix+"judgehost"] %}
24+
- {{ hostvars[host].ansible_host }}:9100
2325
{% endfor %}
24-
- job_name: node_domserver
26+
{% endif %}
27+
{% if groups["domserver"][0] is defined %}
28+
- job_name: {{ group_prefix ~ domjudge }}
2529
basic_auth:
26-
username: "prometheus"
27-
password: "{{ PROMETHEUS_PASS }}"
30+
username: admin
31+
password: {{ ADMIN_PASSWORD }}
32+
metrics_path: /api/v4/metrics/prometheus
33+
scheme: https
2834
tls_config:
2935
insecure_skip_verify: true
30-
scheme: https
3136
static_configs:
3237
- targets:
33-
{% for host in groups["domserver"] %}
34-
- {{ hostvars[host].ansible_host }}:9100
38+
{% for host in groups[group_prefix+"domserver"] %}
39+
- {{ hostvars[host].ansible_host }}
3540
{% endfor %}
36-
- job_name: node_judgehost
41+
- job_name: {{ group_prefix ~ 'db' }}
3742
basic_auth:
3843
username: "prometheus"
39-
password: "{{ PROMETHEUS_PASS }}"
44+
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
4045
tls_config:
4146
insecure_skip_verify: true
4247
scheme: https
4348
static_configs:
4449
- targets:
45-
{% for host in groups["judgehost"] %}
46-
- {{ hostvars[host].ansible_host }}:9100
50+
{% for host in groups[group_prefix+"domserver"] %}
51+
- {{ hostvars[host].ansible_host }}:9104
4752
{% endfor %}
48-
- job_name: node_grafana
53+
- job_name: {{ group_prefix ~ 'node_domserver' }}
4954
basic_auth:
5055
username: "prometheus"
51-
password: "{{ PROMETHEUS_PASS }}"
56+
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
5257
tls_config:
5358
insecure_skip_verify: true
5459
scheme: https
5560
static_configs:
5661
- targets:
57-
{% for host in groups["grafana"] %}
62+
{% for host in groups["domserver"] %}
5863
- {{ hostvars[host].ansible_host }}:9100
5964
{% endfor %}
60-
- job_name: node_mgmt
65+
- job_name: {{ group_prefix ~ 'web_nginx_domserver' }}
6166
basic_auth:
6267
username: "prometheus"
63-
password: "{{ PROMETHEUS_PASS }}"
68+
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
6469
tls_config:
6570
insecure_skip_verify: true
6671
scheme: https
6772
static_configs:
6873
- targets:
69-
{% for host in groups["mgmt"] %}
70-
- {{ hostvars[host].ansible_host }}:9100
74+
{% for host in groups[group_prefix+"domserver"] %}
75+
- {{ hostvars[host].ansible_host }}:9113
7176
{% endfor %}
72-
- job_name: node_scoreboard
77+
- job_name: {{ group_prefix ~ 'web_fpm_domserver' }}
7378
basic_auth:
7479
username: "prometheus"
75-
password: "{{ PROMETHEUS_PASS }}"
80+
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
7681
tls_config:
7782
insecure_skip_verify: true
7883
scheme: https
7984
static_configs:
8085
- targets:
81-
{% for host in groups["scoreboard"] %}
82-
- {{ hostvars[host].ansible_host }}:9100
86+
{% for host in groups[group_prefix+"domserver"] %}
87+
- {{ hostvars[host].ansible_host }}:9253
8388
{% endfor %}
84-
- job_name: node_cds
89+
{% endif %}
90+
{% endfor %}
91+
- job_name: node_grafana
8592
basic_auth:
8693
username: "prometheus"
8794
password: "{{ PROMETHEUS_PASS }}"
@@ -90,23 +97,22 @@ scrape_configs:
9097
scheme: https
9198
static_configs:
9299
- targets:
93-
{% for host in groups["cds"] %}
100+
{% for host in groups["grafana"] %}
94101
- {{ hostvars[host].ansible_host }}:9100
95102
{% endfor %}
96-
- job_name: domjudge
103+
- job_name: node_mgmt
97104
basic_auth:
98-
username: admin
99-
password: {{ ADMIN_PASSWORD }}
100-
metrics_path: /api/v4/metrics/prometheus
101-
scheme: https
105+
username: "prometheus"
106+
password: "{{ PROMETHEUS_PASS }}"
102107
tls_config:
103108
insecure_skip_verify: true
109+
scheme: https
104110
static_configs:
105111
- targets:
106-
{% for host in groups["domserver"] %}
107-
- {{ hostvars[host].ansible_host }}
112+
{% for host in groups["mgmt"] %}
113+
- {{ hostvars[host].ansible_host }}:9100
108114
{% endfor %}
109-
- job_name: 'web_nginx_cds'
115+
- job_name: node_scoreboard
110116
basic_auth:
111117
username: "prometheus"
112118
password: "{{ PROMETHEUS_PASS }}"
@@ -115,10 +121,10 @@ scrape_configs:
115121
scheme: https
116122
static_configs:
117123
- targets:
118-
{% for host in groups["cds"] %}
119-
- {{ hostvars[host].ansible_host }}:9113
124+
{% for host in groups["scoreboard"] %}
125+
- {{ hostvars[host].ansible_host }}:9100
120126
{% endfor %}
121-
- job_name: 'web_nginx_scoreboard'
127+
- job_name: node_cds
122128
basic_auth:
123129
username: "prometheus"
124130
password: "{{ PROMETHEUS_PASS }}"
@@ -127,10 +133,10 @@ scrape_configs:
127133
scheme: https
128134
static_configs:
129135
- targets:
130-
{% for host in groups["scoreboard"] %}
131-
- {{ hostvars[host].ansible_host }}:9113
136+
{% for host in groups["cds"] %}
137+
- {{ hostvars[host].ansible_host }}:9100
132138
{% endfor %}
133-
- job_name: 'web_nginx_domserver'
139+
- job_name: 'web_nginx_cds'
134140
basic_auth:
135141
username: "prometheus"
136142
password: "{{ PROMETHEUS_PASS }}"
@@ -139,10 +145,10 @@ scrape_configs:
139145
scheme: https
140146
static_configs:
141147
- targets:
142-
{% for host in groups["domserver"] %}
148+
{% for host in groups["cds"] %}
143149
- {{ hostvars[host].ansible_host }}:9113
144150
{% endfor %}
145-
- job_name: 'web_fpm_domserver'
151+
- job_name: 'web_nginx_scoreboard'
146152
basic_auth:
147153
username: "prometheus"
148154
password: "{{ PROMETHEUS_PASS }}"
@@ -151,6 +157,6 @@ scrape_configs:
151157
scheme: https
152158
static_configs:
153159
- targets:
154-
{% for host in groups["domserver"] %}
155-
- {{ hostvars[host].ansible_host }}:9253
160+
{% for host in groups["scoreboard"] %}
161+
- {{ hostvars[host].ansible_host }}:9113
156162
{% endfor %}

0 commit comments

Comments
 (0)