X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=a%2Fsite.yml;h=63b6cd1d5841eea70b9431c1beae1a8db3bd5ee0;hp=75da6234c72cad9fc757a7f268dcbacd6bb52eab;hb=f9ccde727d3471c99b909a528aa7168281368084;hpb=5db640adf398b916365ac7a5bd648367acb9355d diff --git a/a/site.yml b/a/site.yml index 75da623..63b6cd1 100644 --- a/a/site.yml +++ b/a/site.yml @@ -1,4 +1,64 @@ --- - hosts: tp.b8.nz roles: - - prom + - 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