Skip to content
Snippets Groups Projects
Verified Commit 67ffa3c8 authored by me5na7qbjqbrp's avatar me5na7qbjqbrp
Browse files

[prometheus] use dig lookup for adm ip

parent ec3da3b8
No related branches found
No related tags found
No related merge requests found
#!/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:
......
......@@ -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:
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment