21 lines
877 B
Django/Jinja
21 lines
877 B
Django/Jinja
{%- set config = prometheus_agent.agents.promtail.config.copy() -%}
|
|
|
|
{%- if 'clients' not in config -%}
|
|
{%- set tmp = config.setdefault('clients', []) -%}
|
|
{%- for i in prometheus_agent.scrapers if prometheus_agent.scrapers[i].get("loki") -%}
|
|
{%- set lokiconfig = {}|combine({ "external_labels": merged_prometheus_labels|combine( {"instance": inventory_hostname} ) }, prometheus_agent.scrapers[i]['loki'] ) -%}
|
|
{%- set tmp = config.clients.append(lokiconfig) -%}
|
|
{%- endfor -%}
|
|
{%- endif -%}
|
|
|
|
{%- if 'scrape_configs' not in config -%}
|
|
{%- set tmp = config.setdefault('scrape_configs', []) -%}
|
|
{%- for key, value in prometheus_agent.agents.promtail.scrape_jobs.items() if value -%}
|
|
{%- set tmp = value.setdefault('job_name', key) -%}
|
|
{%- set tmp = config.scrape_configs.append(value) -%}
|
|
{%- endfor -%}
|
|
{%- endif -%}
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
{{ config|to_nice_yaml(indent=2) }}
|