Browse Source

roles/nginx: new monitoring formats

python3
Zolfa 4 years ago
parent
commit
83bc4f13cb
Signed by: zolfa GPG Key ID: E1A43B038C4D6616
2 changed files with 28 additions and 0 deletions
  1. +1
    -0
      roles/nginx/defaults/main.yml
  2. +27
    -0
      roles/nginx/tasks/main.yaml

+ 1
- 0
roles/nginx/defaults/main.yml View File

@ -1,4 +1,5 @@
---
host_fqdn: '{{ ansible_hostname }}.dmz.{{ domain }}'
server_fqdn: '{{ ansible_hostname }}.{{ domain }}'
# Accept HTTPS over PROXY PROTOCOL on Alternate Port: 10443
proxy_protocol: true


+ 27
- 0
roles/nginx/tasks/main.yaml View File

@ -35,4 +35,31 @@
dest: '/etc/nginx/sites-enabled/{{ server_fqdn }}.conf'
state: 'link'
notify: 'restart nginx'
- name: 'MONITORNIG | add service HTTP/{{ server_fqdn }}'
block:
- name: 'MONITORING | fetch monitored HTTP for current host'
set_fact:
vhosts: >
{{ hostvars[monitoring_host]['monitoring_facts'][host_fqdn]['vhosts']
| default([]) }}
- name: 'MONITORING | add HTTP/{{ server_fqdn }} to monitored service'
set_fact:
nginx_monitoring_entry: >
{{ {
host_fqdn: {
'address': ansible_host,
'vhosts': vhosts + [server_fqdn],
}
} }}
- name: 'MONITORING | update monitoring facts'
set_fact:
monitoring_facts: >
{{ hostvars[monitoring_host]['monitoring_facts']
| default({})
| combine(nginx_monitoring_entry, recursive=true) }}
delegate_facts: true
delegate_to: '{{ monitoring_host }}'
tags:
- 'monitoring'
...

Loading…
Cancel
Save