2 files changed, 8 insertions(+), 3 deletions(-)
M roles/grafana/tasks/main.yml
R roles/grafana/{files/datasources.yml => templates/datasources.yml.j2}
M roles/grafana/tasks/main.yml => roles/grafana/tasks/main.yml +3 -2
@@ 1,6 1,7 @@
---
- name: Get secrets
ansible.builtin.set_fact:
+ alertmanager_secrets: "{{ lookup('community.hashi_vault.hashi_vault', 'ansible/data/alertmanager') }}"
grafana_secrets: "{{ lookup('community.hashi_vault.hashi_vault', 'ansible/data/grafana') }}"
- name: Install
@@ 31,8 32,8 @@
- /var/lib/grafana/dashboards
- name: Configure datasources
- ansible.builtin.copy:
- src: datasources.yml
+ ansible.builtin.template:
+ src: datasources.yml.j2
dest: /etc/grafana/provisioning/datasources/datasources.yml
owner: grafana
group: grafana
R roles/grafana/files/datasources.yml => roles/grafana/templates/datasources.yml.j2 +5 -1
@@ 8,6 8,10 @@ datasources:
- name: Alertmanager
type: alertmanager
access: proxy
- url: http://localhost:9093
+ url: https://alertmanager.xenrox.net
+ basicAuth: true
+ basicAuthUser: {{ alertmanager_secrets['user'] }}
+ secureJsonData:
+ basicAuthPassword: {{ alertmanager_secrets['pass'] }}
jsonData:
implementation: prometheus