File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
playbooks/api/roles/api/tasks Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ plugin : aws_ec2
3+ profile : dump-monitoring
4+
5+ regions :
6+ - eu-central-1
7+
8+ hostnames :
9+ - ip-address
10+
11+ filters :
12+ tag:Project : dump-monitoring
13+ tag:Environment : production
14+
15+ keyed_groups :
16+ - key : tags.Role
17+ leading_separator : false
Original file line number Diff line number Diff line change 1111 group : ' {{ ansible_user }}'
1212 mode : 0600
1313
14+ - name : Get the ip address of the prometheus production server
15+ command : cd $(git rev-parse --show-toplevel); ansible-inventory -i infrastructure/ansible/inventories/prometheus.aws_ec2.yml --list | jq -r '.aws_ec2.hosts[0]'
16+ register : production_ip
17+
1418- name : Create new api docker container
1519 docker_container :
1620 name : ' {{ container_name }}'
3034 traefik.http.middlewares.api-cors.headers.accesscontrolmaxage : ' 100'
3135 traefik.http.middlewares.api-cors.headers.addvaryheader : ' true'
3236 traefik.http.routers.api.middlewares : ' api-retry, api-cors'
33- # Setting a service property ensures that the generated service name will be consistent between versions
3437 traefik.http.services.api.loadbalancer.server.scheme : ' http'
38+ # Router specifically for /api/metrics with IP restriction
39+ traefik.http.middlewares.metrics-whitelist.ipwhitelist.sourcerange : ' {{ production_ip.stdout }}'
40+ traefik.http.routers.api-metrics.rule : ' Host(`{{ api_domain }}`) && PathPrefix(`/api/metrics`)'
41+ traefik.http.routers.api-metrics.middlewares : metrics-whitelist
3542
3643- name : Swap docker containers if new one is healthy
3744 block :
You can’t perform that action at this time.
0 commit comments