Skip to content

Commit

Permalink
Split for WF setups
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vmcj committed Sep 2, 2024
1 parent 39a28a8 commit 52ae9cf
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 47 deletions.
2 changes: 1 addition & 1 deletion provision-contest/ansible/domserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- python3-netaddr

- name: Setup domserver
hosts: domserver
hosts: domserver,online-domserver
vars:
host_type: domserver
become: true
Expand Down
2 changes: 2 additions & 0 deletions provision-contest/ansible/group_vars/onprem/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/secret.yml
/all.yml
22 changes: 22 additions & 0 deletions provision-contest/ansible/hosts.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ ansible_python_interpreter=/usr/bin/python3
# When moving clients for ad-hoc actions:
# move them to their own group to keep hosts files on deployed machines in sync.

[onprem:children]
domserver
judgehost
cds
grafana
admin
presclient
presadmin
scoreboard
mgmt
autoanalyst

[online:children]
online-domserver
online-judgehost

[domserver]
domjudge-primary ansible_host=10.3.3.216 KEEPALIVED_PRIORITY=100 EFI_ORDER='0\,1\,3\,4'
domjudge-backup ansible_host=10.3.3.217 KEEPALIVED_PRIORITY=99 EFI_ORDER='0\,1\,3\,4'
Expand Down Expand Up @@ -63,3 +79,9 @@ domjudge-scoreboard ansible_host=10.2.2.229
domjudge-mgmg ansible_host=10.3.3.223

[autoanalyst]

[online-domserver]
online-domserver ansible_host=192.168.255.255

[online-judgehost]
online-judgehost1 ansible_host=192.168.255.255
2 changes: 1 addition & 1 deletion provision-contest/ansible/judgehost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This playbook installs the DOMjudge judgehosts

- name: Setup judgehost
hosts: judgehost
hosts: judgehost,online-judgehost
strategy: free
vars:
host_type: judgehost
Expand Down
96 changes: 51 additions & 45 deletions provision-contest/ansible/roles/grafana/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,79 +9,86 @@ scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'db'
{% for group_prefix in GROUP_PREFIXES %}
{% if groups[group_prefix+"judgehost"][0] is defined %}
- job_name: node_judgehost
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ hostvars[groups[group_prefix+"judgehost"][0]]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9104
{% for host in groups[group_prefix+"judgehost"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_domserver
{% endif %}
{% if groups["domserver"][0] is defined %}
- job_name: {{ group_prefix ~ domjudge }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
username: admin
password: {{ ADMIN_PASSWORD }}
metrics_path: /api/v4/metrics/prometheus
scheme: https
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9100
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}
{% endfor %}
- job_name: node_judgehost
- job_name: {{ group_prefix ~ 'db' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["judgehost"] %}
- {{ hostvars[host].ansible_host }}:9100
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9104
{% endfor %}
- job_name: node_grafana
- job_name: {{ group_prefix ~ 'node_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["grafana"] %}
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: node_mgmt
- job_name: {{ group_prefix ~ 'web_nginx_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["mgmt"] %}
- {{ hostvars[host].ansible_host }}:9100
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}
- job_name: node_scoreboard
- job_name: {{ group_prefix ~ 'web_fpm_domserver' }}
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
password: "{{ hostvars[groups[group_prefix+"domserver"][0]]['PROMETHEUS_PASS'] }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9100
{% for host in groups[group_prefix+"domserver"] %}
- {{ hostvars[host].ansible_host }}:9253
{% endfor %}
- job_name: node_cds
{% endif %}
{% endfor %}
- job_name: node_grafana
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -90,23 +97,22 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["cds"] %}
{% for host in groups["grafana"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: domjudge
- job_name: node_mgmt
basic_auth:
username: admin
password: {{ ADMIN_PASSWORD }}
metrics_path: /api/v4/metrics/prometheus
scheme: https
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
tls_config:
insecure_skip_verify: true
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}
{% for host in groups["mgmt"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_nginx_cds'
- job_name: node_scoreboard
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -115,10 +121,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9113
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_nginx_scoreboard'
- job_name: node_cds
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -127,10 +133,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9113
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9100
{% endfor %}
- job_name: 'web_nginx_domserver'
- job_name: 'web_nginx_cds'
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -139,10 +145,10 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
{% for host in groups["cds"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}
- job_name: 'web_fpm_domserver'
- job_name: 'web_nginx_scoreboard'
basic_auth:
username: "prometheus"
password: "{{ PROMETHEUS_PASS }}"
Expand All @@ -151,6 +157,6 @@ scrape_configs:
scheme: https
static_configs:
- targets:
{% for host in groups["domserver"] %}
- {{ hostvars[host].ansible_host }}:9253
{% for host in groups["scoreboard"] %}
- {{ hostvars[host].ansible_host }}:9113
{% endfor %}

0 comments on commit 52ae9cf

Please sign in to comment.