diff --git a/inventory/group_vars/monitoring_server.yml b/inventory/group_vars/monitoring_server.yml new file mode 100644 index 0000000..386d58a --- /dev/null +++ b/inventory/group_vars/monitoring_server.yml @@ -0,0 +1,6 @@ +--- + +hosts_to_monitor: + - "localhost:9100" + - "10.7.10.96:9100" + - "10.7.10.97:9100" diff --git a/inventory/hosts.ini b/inventory/hosts.ini index fdde0ab..1a83ab0 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -21,6 +21,9 @@ lb-v3 ansible_host=lb-v3.int.metaunix.net [kickstart_servers] ks-v2 ansible_host=ks-v2.int.metaunix.net +[monitoring_server] +pi5b2g ansible_host=10.7.10.106 + [munin_masters] munin-v1 ansible_host=munin-v1.int.metaunix.net diff --git a/playbooks/exporters.yml b/playbooks/exporters.yml new file mode 100644 index 0000000..7b9157c --- /dev/null +++ b/playbooks/exporters.yml @@ -0,0 +1,10 @@ +--- + +- name: Deploy node_exporter across all fleet hosts + hosts: all + become: true + + roles: + - role: prometheus.prometheus.node_exporter + vars: + node_exporter_web_listen_address: "0.0.0.0:9100" diff --git a/playbooks/grafana.yml b/playbooks/grafana.yml new file mode 100644 index 0000000..b48f0b0 --- /dev/null +++ b/playbooks/grafana.yml @@ -0,0 +1,71 @@ +--- + +- name: Deploy standalone Prometheus on Raspberry Pi 5 + hosts: monitoring_server + become: true + + vars: + # Bind to all interfaces on default port + prometheus_web_listen_address: "0.0.0.0:9090" + + # Reduce retention to save storage/microSD wear (default is 15d) + prometheus_storage_retention: "60d" + + # Self-scrape configuration + prometheus_scrape_configs: + - job_name: "prometheus" + metrics_path: "/metrics" + static_configs: + - targets: + - "localhost:9090" + - job_name: "node_exporter" + metrics_path: "/metrics" + static_configs: + - targets: + - "localhost:9100" + - "10.7.10.96:9100" + - "10.7.10.97:9100" + + roles: + - role: prometheus.prometheus.prometheus + +- name: Deploy Grafana on Raspberry Pi 5 + hosts: monitoring_server + become: true + + pre_tasks: + - name: Ensure python3-debian is present for deb822 repository support + ansible.builtin.apt: + name: python3-debian + state: present + update_cache: true + + roles: + - role: grafana.grafana.grafana + vars: + grafana_version: "latest" + + # All grafana.ini sections now live under grafana_ini + grafana_ini: + server: + http_port: 3000 + http_addr: "0.0.0.0" + security: + admin_user: "admin" + admin_password: "LimpBizkit6" + analytics: + reporting_enabled: false + check_for_updates: false + + # Provision datasources directly + grafana_datasources: + - name: "Prometheus" + type: "prometheus" + access: "proxy" + url: "http://localhost:9090" + isDefault: true + editable: true + + # Optional: install community plugins automatically + # grafana_plugins: + # - grafana-piechart-panel diff --git a/playbooks/site.yml b/playbooks/site.yml index a9669e0..735e456 100644 --- a/playbooks/site.yml +++ b/playbooks/site.yml @@ -10,6 +10,10 @@ import_playbook: nfs_client.yml - name: Packages import_playbook: packages.yml +- name: Grafana / Prometheus + import_playbook: grafana.yml +- name: node_exporter and others for Prometheus + import_playbook: exporters.yml - name: Munin import_playbook: munin.yml - name: Gitea diff --git a/requirements.yml b/requirements.yml index d2c7a7c..d8c8487 100644 --- a/requirements.yml +++ b/requirements.yml @@ -7,6 +7,10 @@ collections: version: 5.3.0 - name: containers.podman version: 1.20.2 + - name: grafana.grafana + version: 6.1.0 + - name: prometheus.prometheus + version: 0.30.1 roles: - name: gballan.sssd