[prometheus] use dig lookup for adm ip

certbot_on_virtu
Alexandre Iooss 2020-05-25 12:42:56 +02:00
parent ec3da3b8e5
commit 67ffa3c893
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 1 additions and 12 deletions

View File

@ -1,16 +1,5 @@
#!/usr/bin/env ansible-playbook
---
# Set variable adm_iface for all servers
- hosts: server
tasks:
- name: Register adm interface in adm_iface variable
shell: set -o pipefail && grep adm /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
register: adm_iface
check_mode: false
changed_when: true
args:
executable: /bin/bash
# Deploy Prometheus and Grafana on monitoring server
- hosts: fyre.adm.crans.org
vars:

View File

@ -4,7 +4,7 @@
# 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
# (\\\\d to mean \d), and escape newlines too.
ARGS="--web.listen-address={{ hostvars[inventory_hostname]['ansible_' + adm_iface.stdout].ipv4.address }}:9100"
ARGS="--web.listen-address={{ lookup('dig', ansible_host) }}:9100"
# Prometheus-node-exporter supports the following options:
#