[monitoring] Use ip filter for adm

certbot_on_virtu
Alexandre Iooss 2020-06-01 19:42:47 +02:00
parent 43d66a3257
commit 0d36ac644c
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
4 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,5 @@
--- ---
# Custom header
dirty: "{{lookup('pipe', 'git diff --quiet || echo dirty')}}" dirty: "{{lookup('pipe', 'git diff --quiet || echo dirty')}}"
ansible_header: | ansible_header: |
+++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++
@ -11,3 +12,6 @@ ansible_header: |
{% endif %} {% endif %}
+++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++
# Crans subnets
adm_subnet: 10.231.136.0/24

View File

@ -38,10 +38,14 @@
# Monitor all hosts # Monitor all hosts
- hosts: server,test_vm - hosts: server,test_vm
vars:
adm_ipv4: "{{ ansible_all_ipv4_addresses | ipaddr(adm_subnet) | first }}"
roles: ["prometheus-node-exporter"] roles: ["prometheus-node-exporter"]
# Export apache metrics # Export apache metrics
- hosts: zamok.adm.crans.org - hosts: zamok.adm.crans.org
vars:
adm_ipv4: "{{ ansible_all_ipv4_addresses | ipaddr(adm_subnet) | first }}"
roles: ["prometheus-apache-exporter"] roles: ["prometheus-apache-exporter"]
# Configure HP RAID monitoring # Configure HP RAID monitoring

View File

@ -12,5 +12,5 @@
path: /etc/default/prometheus-apache-exporter path: /etc/default/prometheus-apache-exporter
regexp: '^ARGS=' regexp: '^ARGS='
line: | line: |
ARGS="-telemetry.address={{ ansible_hostname }}.adm.crans.org:9117" ARGS="-telemetry.address={{ adm_ipv4 }}:9117"
notify: Restart prometheus-apache-exporter notify: Restart prometheus-apache-exporter

View File

@ -4,7 +4,7 @@
# Due to shell scaping, to pass backslashes for regexes, you need to double # Due to shell scaping, to pass backslashes for regexes, you need to double
# them (\\d for \d). If running under systemd, you need to double them again # them (\\d for \d). If running under systemd, you need to double them again
# (\\\\d to mean \d), and escape newlines too. # (\\\\d to mean \d), and escape newlines too.
ARGS="--web.listen-address={{ lookup('dig', ansible_host) }}:9100" ARGS="--web.listen-address={{ adm_ipv4 }}:9100"
# Prometheus-node-exporter supports the following options: # Prometheus-node-exporter supports the following options:
# #