add promtail support

This commit is contained in:
nd 2021-11-29 21:23:44 +01:00
parent 1b9547ecd8
commit 248ed5fd02
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
4 changed files with 60 additions and 1 deletions

View file

@ -56,7 +56,7 @@
name: certificates
vars:
certificates:
certs: "{{ {}|combine(prometheus_certs, inventory_certs, recursive=True) }}"
certs: "{{ { 'prometheus_agent': ({}|combine(prometheus_certs, inventory_certs, recursive=True))['prometheus_agent'] } }}"
- name: slurp up all scraper certs
loop: "{{ prometheus_agent.scrapers.keys()|list }}"
@ -123,6 +123,21 @@
dest: /etc/prometheus/conf.d/rule_files/agent_{{ inventory_hostname }}.conf
mode: 0644
- name: handle grafana-promtail
when: prometheus_agent.agents.promtail.enable
block:
- name: install promtail
apt:
pkg: grafana-promtail
- name: wrtie promtail config
notify: restart grafana-promtail
template:
owner: grafana-promtail
group: grafana-promtail
mode: 0640
dest: /etc/grafana-promtail.yml
src: grafana-promtail.yml.j2
- name: create node-exporter-textfile group
ansible.builtin.group:
name: node-exporter-textfile