summaryrefslogtreecommitdiff
path: root/roles/nginx/auth/whawty-sso/login/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx/auth/whawty-sso/login/tasks/main.yml')
-rw-r--r--roles/nginx/auth/whawty-sso/login/tasks/main.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/nginx/auth/whawty-sso/login/tasks/main.yml b/roles/nginx/auth/whawty-sso/login/tasks/main.yml
index e2267238..675a3ffa 100644
--- a/roles/nginx/auth/whawty-sso/login/tasks/main.yml
+++ b/roles/nginx/auth/whawty-sso/login/tasks/main.yml
@@ -25,6 +25,29 @@
state: directory
mode: 0700
+- name: make sure prometheus directories exist
+ when: "(whawty_nginx_sso_logins | dict2items | selectattr('value.config.prometheus', 'defined') | length) > 0"
+ file:
+ path: /etc/prometheus/exporter
+ state: directory
+
+- name: make sure prometheus directories exist
+ loop: "{{ whawty_nginx_sso_logins | dict2items | selectattr('value.config.prometheus', 'defined') }}"
+ loop_control:
+ label: "{{ item.key }}"
+ copy:
+ content: |
+ {% if 'listen' in item.value.config.prometheus %}
+ {% set listen = item.value.config.prometheus.listen %}
+ {% else %}
+ {% set listen = item.value.config.web.listen %}
+ {% endif %}
+ location = /whawty-nginx-sso/{{ item.key }} {
+ proxy_pass http://127.0.0.1:{{ listen | split(':') | last }}{{ item.value.config.prometheus.path | default('/metrics') }};
+ }
+ dest: "/etc/prometheus/exporter/whawty-nginx-sso-{{ item.key }}.locations"
+ notify: reload nginx
+
- name: generate configuration file
loop: "{{ whawty_nginx_sso_logins | dict2items }}"