[prometheus] use dig lookup for adm ip
parent
ec3da3b8e5
commit
67ffa3c893
|
@ -1,16 +1,5 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
#!/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
|
# Deploy Prometheus and Grafana on monitoring server
|
||||||
- hosts: fyre.adm.crans.org
|
- hosts: fyre.adm.crans.org
|
||||||
vars:
|
vars:
|
||||||
|
|
|
@ -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={{ 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:
|
# Prometheus-node-exporter supports the following options:
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue