Bind hostname to 172.0.1.1 and use FQDN in config

This makes that we see better labels in Grafana and that we don't
need to expose the address externally.
This commit is contained in:
Thomas Kleinendorst 2024-09-23 12:23:05 +02:00
parent 3c0b5ebdab
commit 71499b2610
3 changed files with 21 additions and 6 deletions

View file

@ -8,4 +8,4 @@
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: "^127.0.1.1.*$"
line: "{{ ansible_facts['default_ipv4']['address'] }} {{ hostname }}.kleinendorst.info {{ hostname }}"
line: "127.0.0.1 {{ hostname }}.kleinendorst.info {{ hostname }}"

View file

@ -2,12 +2,24 @@
- name: Include the Prometheus role
ansible.builtin.include_role:
name: prometheus.prometheus.prometheus
- name: Include simple-reverse-proxy role - Prometheus
ansible.builtin.include_role:
name: simple-reverse-proxy
vars:
simple_reverse_proxy_internal_port: 9090
simple_reverse_proxy_internal_subdomain: prometheus
- name: Include the Prometheus - node exporter role
ansible.builtin.include_role:
name: prometheus.prometheus.node_exporter
- name: Include the Prometheus - alertmanager role
ansible.builtin.include_role:
name: prometheus.prometheus.alertmanager
- name: Include simple-reverse-proxy role - Prometheus
ansible.builtin.include_role:
name: simple-reverse-proxy
vars:
simple_reverse_proxy_internal_port: 9093
simple_reverse_proxy_internal_subdomain: alertmanager
# region: Install Grafana
- name: Include user role
ansible.builtin.include_role:
@ -32,7 +44,7 @@
podman_container_volumes:
- name: grafana_storage
mnt: /var/lib/grafana
- name: Include simple-reverse-proxy role
- name: Include simple-reverse-proxy role - Grafana
ansible.builtin.include_role:
name: simple-reverse-proxy
vars:

View file

@ -4,13 +4,14 @@ prometheus_version: "2.54.1"
prometheus_targets:
prometheus:
- targets:
- 127.0.0.1:9090
- raspberry-pi-1.kleinendorst.info:9090
node:
- targets:
- 127.0.0.1:9100
- raspberry-pi-1.kleinendorst.info:9100
grafana:
- targets:
- 127.0.0.1:3000
- raspberry-pi-1.kleinendorst.info:3000
prometheus_web_listen_address: 127.0.0.1:9090
prometheus_scrape_configs:
- job_name: "prometheus"
file_sd_configs:
@ -27,15 +28,17 @@ prometheus_scrape_configs:
prometheus_alertmanager_config:
- static_configs:
- targets:
- 127.0.0.1:9093
- raspberry-pi-1.kleinendorst.info:9093
# Node exporter
node_exporter_version: "1.8.2"
node_exporter_enabled_collectors:
- systemd
- {"textfile": {"directory": "{{ node_exporter_textfile_dir }}"}}
- processes
node_exporter_web_listen_address: 127.0.0.1:9100
# Alertmanager
alertmanager_version: "0.27.0"
alertmanager_web_listen_address: 127.0.0.1:9093
# Telegram configuration inspired by this source:
# https://www.stranatesta.eu/tech/how-to-configure-prometheus-alertmanager-to-send-alerts-to-telegram/#configure-alertmanager
alertmanager_receivers: