diff options
Diffstat (limited to 'roles/nginx/auth/whawty-sso/login')
-rw-r--r-- | roles/nginx/auth/whawty-sso/login/handlers/main.yml | 5 | ||||
-rw-r--r-- | roles/nginx/auth/whawty-sso/login/tasks/main.yml | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/roles/nginx/auth/whawty-sso/login/handlers/main.yml b/roles/nginx/auth/whawty-sso/login/handlers/main.yml index f4bbf308..dea155d1 100644 --- a/roles/nginx/auth/whawty-sso/login/handlers/main.yml +++ b/roles/nginx/auth/whawty-sso/login/handlers/main.yml @@ -4,3 +4,8 @@ service: name: "whawty-nginx-sso@{{ item }}.service" state: restarted + +- name: reload nginx + service: + name: nginx + state: reloaded 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 }}" |