summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/grafana/meta/argument_specs.yml14
-rw-r--r--roles/grafana/tasks/main.yml6
-rw-r--r--roles/prometheus/defaults/main.yml1
-rw-r--r--roles/prometheus/meta/argument_specs.yml5
-rw-r--r--roles/prometheus/templates/prometheus.yml.j28
5 files changed, 22 insertions, 12 deletions
diff --git a/roles/grafana/meta/argument_specs.yml b/roles/grafana/meta/argument_specs.yml
index 5a38b97d..c9d53bb1 100644
--- a/roles/grafana/meta/argument_specs.yml
+++ b/roles/grafana/meta/argument_specs.yml
@@ -53,23 +53,19 @@ argument_specs:
description: "FQDN for the grafana nginx vhost (e.g. 'monitor.home.arpa')."
default: "monitor.home.arpa"
grafana_dashboards:
- description: "List of community dashboards to download and provision"
+ description: "List of dashboards to download and provision"
type: "list"
elements: "dict"
default: []
options:
- id:
- description: "Grafana.com dashboard ID"
- type: "int"
- required: true
- revision:
- description: "Dashboard revision number"
- type: "int"
- required: true
name:
description: "Local name for the dashboard file"
type: "str"
required: true
+ url:
+ description: "URL to download the dashboard JSON from"
+ type: "str"
+ required: true
datasource_mappings:
description: "List of datasource variable mappings for the dashboard"
type: "list"
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
index f7b7d851..088d61c7 100644
--- a/roles/grafana/tasks/main.yml
+++ b/roles/grafana/tasks/main.yml
@@ -53,7 +53,7 @@
notify: "Restart grafana"
no_log: true
-- name: "Provision Grafana community dashboards"
+- name: "Provision Grafana dashboards"
notify: "Restart grafana"
# grafana downloaded dashboards are being rewritten after successful download
# this is to correct the datasource mapping in the downloaded files
@@ -61,10 +61,10 @@
tags:
- molecule-idempotence-notest
block:
- - name: "Download Grafana community dashboards"
+ - name: "Download Grafana dashboards"
become: true
ansible.builtin.get_url:
- url: "https://grafana.com/api/dashboards/{{ item.id }}/revisions/{{ item.revision }}/download"
+ url: "{{ item.url }}"
dest: "/etc/grafana/provisioning/dashboards/{{ item.name }}.json"
owner: "grafana"
group: "grafana"
diff --git a/roles/prometheus/defaults/main.yml b/roles/prometheus/defaults/main.yml
index cd91dee6..61c383ed 100644
--- a/roles/prometheus/defaults/main.yml
+++ b/roles/prometheus/defaults/main.yml
@@ -9,3 +9,4 @@ prometheus_targets:
prometheus_node_exporter_targets: []
prometheus_hostname: "metrics.home.arpa"
+prometheus_extra_scrape_configs: []
diff --git a/roles/prometheus/meta/argument_specs.yml b/roles/prometheus/meta/argument_specs.yml
index 5f908119..11beae38 100644
--- a/roles/prometheus/meta/argument_specs.yml
+++ b/roles/prometheus/meta/argument_specs.yml
@@ -32,3 +32,8 @@ argument_specs:
type: "str"
description: "FQDN for the prometheus nginx vhost (e.g. 'metrics.home.arpa')."
default: "metrics.home.arpa"
+ prometheus_extra_scrape_configs:
+ description: "Additional Prometheus scrape jobs"
+ type: "list"
+ elements: "dict"
+ default: []
diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2
index c43864ea..f7f2ae24 100644
--- a/roles/prometheus/templates/prometheus.yml.j2
+++ b/roles/prometheus/templates/prometheus.yml.j2
@@ -15,3 +15,11 @@ scrape_configs:
- targets: {{ prometheus_node_exporter_targets | to_yaml }}
scrape_interval: {{ prometheus_scrape_interval }}
metrics_path: /metrics
+{% for job in prometheus_extra_scrape_configs %}
+
+ - job_name: '{{ job.name }}'
+ static_configs:
+ - targets: {{ job.targets | to_yaml }}
+ scrape_interval: {{ job.scrape_interval | default(prometheus_scrape_interval) }}
+ metrics_path: {{ job.metrics_path | default('/metrics') }}
+{% endfor %}