add prometheus and friends
[distro-setup] / a / site.yml
1 ---
2 - hosts: tp.b8.nz
3 roles:
4 - role: prom
5 prometheus_scrape_configs:
6 - job_name: "prometheus"
7 metrics_path: "{{ prometheus_metrics_path }}"
8 static_configs:
9 - targets:
10 - "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:9090"
11 - job_name: "node"
12 basic_auth:
13 username: prom
14 password_file: /etc/prometheus-pass
15 scheme: "https"
16 file_sd_configs:
17 - files:
18 - "{{ prometheus_config_dir }}/file_sd/node.yml"
19
20 prometheus_targets:
21 node:
22 - targets: "{{ groups.all|map('regex_replace','$',':9101')|list }}"
23
24 - role: node-exporter
25 node_exporter_web_listen_address: "127.0.0.1:9100"
26 - role: alertmanager
27 alertmanager_smtp:
28 smarthost: 'localhost:25'
29 from: "alertmanager@{{ ansible_fqdn | default(ansible_host) | default('localhost') }}"
30 require_tls: false
31 alertmanager_route:
32 receiver: defaultreceiver
33 alertmanager_receivers:
34 - name: defaultreceiver
35 email_configs:
36 - to: alerts@iankelling.org
37 html: "{% raw -%}{{ template \"email.default.html\" . }}{% endraw -%}"
38 text: "{% raw -%}{{ template \"email.default.text\" . }}{% endraw -%}"
39
40 alertmanager_listen_address: '127.0.0.1:9093'
41 - role: grafana
42 grafana_address: "127.0.0.1"
43 # iank: playbook will halt if no password is set. this is only
44 # available to localhost, so i dont really care, but might as well
45 # generate a pass isntead of putting in pw123 etc.
46 grafana_security: { admin_user: admin, admin_password: spheroid.recantation.shank }
47 grafana_datasources:
48 - name: prometheus
49 type: prometheus
50 access: proxy
51 url: 'http://{{ prometheus_web_listen_address }}'
52 basicAuth: false
53 isDefault: true
54 # This is based on looking at highly downloaded dashboards here
55 # https://grafana.com/dashboards?dataSource=prometheus&collector=nodeExporter
56 # Which is where you are lead to from
57 # https://prometheus.io/docs/visualization/grafana/
58 grafana_dashboards:
59 - dashboard_id: 1860
60 revision_id: 13
61 datasource: prometheus
62 - dashboard_id: 405
63 revision_id: 8
64 datasource: prometheus