--- - hosts: tp.b8.nz roles: - role: prom prometheus_scrape_configs: - job_name: "prometheus" metrics_path: "{{ prometheus_metrics_path }}" static_configs: - targets: - "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:9090" - job_name: "node" basic_auth: username: prom password_file: /etc/prometheus-pass scheme: "https" file_sd_configs: - files: - "{{ prometheus_config_dir }}/file_sd/node.yml" prometheus_targets: node: - targets: "{{ groups.all|map('regex_replace','$',':9101')|list }}" - role: node-exporter node_exporter_web_listen_address: "127.0.0.1:9100" - role: alertmanager alertmanager_smtp: smarthost: 'localhost:25' from: "alertmanager@{{ ansible_fqdn | default(ansible_host) | default('localhost') }}" require_tls: false alertmanager_route: receiver: defaultreceiver alertmanager_receivers: - name: defaultreceiver email_configs: - to: alerts@iankelling.org html: "{% raw -%}{{ template \"email.default.html\" . }}{% endraw -%}" text: "{% raw -%}{{ template \"email.default.text\" . }}{% endraw -%}" alertmanager_listen_address: '127.0.0.1:9093' - role: grafana grafana_address: "127.0.0.1" # iank: playbook will halt if no password is set. this is only # available to localhost, so i dont really care, but might as well # generate a pass isntead of putting in pw123 etc. grafana_security: { admin_user: admin, admin_password: spheroid.recantation.shank } grafana_datasources: - name: prometheus type: prometheus access: proxy url: 'http://{{ prometheus_web_listen_address }}' basicAuth: false isDefault: true # This is based on looking at highly downloaded dashboards here # https://grafana.com/dashboards?dataSource=prometheus&collector=nodeExporter # Which is where you are lead to from # https://prometheus.io/docs/visualization/grafana/ grafana_dashboards: - dashboard_id: 1860 revision_id: 13 datasource: prometheus - dashboard_id: 405 revision_id: 8 datasource: prometheus