move defaults vars to defaults directory

This commit is contained in:
Camille Prugnard 2021-09-30 12:25:21 +02:00
parent d94fefc0e3
commit 925f1a762d
6 changed files with 30 additions and 11 deletions

View File

@ -1 +1,20 @@
--- ---
awh_services_docker_pull: "no"
prometheus_exporter_packages: []
prometheus_mongodb_exporter_database: "database"
prometheus_mongodb_exporter_host: "localhost"
prometheus_mongodb_exporter_port: 27017
prometheus_postgres_exporter_host: "/var/run/postgresql/"
prometheus_postgres_exporter_sslmode: "disable"
prometheus_postgres_exporter_user: "postgres"
prometheus_server_enable: false
prometheus_server_global_evaluation_interval: 15
prometheus_server_global_scrape_interval: 15
prometheus_server_job_name: "prometheus"
prometheus_server_scrape_interval: 5
prometheus_server_scrape_timeout: 5
prometheus_server_version: "latest"

View File

@ -43,7 +43,7 @@
docker_container: docker_container:
name: prometheus name: prometheus
hostname: '{{ inventory_hostname }}' hostname: '{{ inventory_hostname }}'
image: prom/prometheus:{{ prometheus_server_version|default("latest") }} image: prom/prometheus:{{ prometheus_server_version }}
volumes: volumes:
- /etc/prometheus/:/etc/prometheus/ - /etc/prometheus/:/etc/prometheus/
- prometheus_data:/prometheus - prometheus_data:/prometheus
@ -61,7 +61,7 @@
log_options: log_options:
tag: docker_prometheus tag: docker_prometheus
restart_policy: 'unless-stopped' restart_policy: 'unless-stopped'
pull: '{{ awh_services_docker_pull|default("no") }}' pull: '{{ awh_services_docker_pull }}'
tags: tags:
- prometheus - prometheus
notify: notify:

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }} # {{ ansible_managed }}
{% if (prometheus_mongodb_exporter_user is defined) and (prometheus_mongodb_exporter_pass is defined) %} {% if (prometheus_mongodb_exporter_user is defined) and (prometheus_mongodb_exporter_pass is defined) %}
MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_user }}:{{ prometheus_mongodb_exporter_pass }}@{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }} MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_user }}:{{ prometheus_mongodb_exporter_pass }}@{{ prometheus_mongodb_exporter_host }}:{{ prometheus_mongodb_exporter_port }}/{{ prometheus_mongodb_exporter_database }}
{% else %} {% else %}
MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_host|default("localhost") }}:{{ prometheus_mongodb_exporter_port|default("27017") }}/{{ prometheus_mongodb_exporter_database|default("admin") }} MONGODB_URI=mongodb://{{ prometheus_mongodb_exporter_host }}:{{ prometheus_mongodb_exporter_port }}/{{ prometheus_mongodb_exporter_database }}
{% endif %} {% endif %}

View File

@ -1,2 +1,2 @@
# {{ ansible_managed }} # {{ ansible_managed }}
DATA_SOURCE_NAME="user={{ prometheus_postgres_exporter_user|default("postgres") }} host={{ prometheus_postgres_exporter_host|default("/var/run/postgresql/") }} sslmode={{ prometheus_postgres_exporter_sslmode|default("disable") }}" DATA_SOURCE_NAME="user={{ prometheus_postgres_exporter_user }} host={{ prometheus_postgres_exporter_host }} sslmode={{ prometheus_postgres_exporter_sslmode }}"

View File

@ -1,8 +1,8 @@
# {{ ansible_managed }} # {{ ansible_managed }}
global: global:
scrape_interval: {{ prometheus_server_global_scrape_interval | default(15) }}s # Set the scrape interval to every 15 seconds. Default is every 1 minute. scrape_interval: {{ prometheus_server_global_scrape_interval }}s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: {{ prometheus_server_global_evaluation_interval | default(15) }}s # Evaluate rules every 15 seconds. The default is every 1 minute. evaluation_interval: {{ prometheus_server_global_evaluation_interval }}s # Evaluate rules every 15 seconds. The default is every 1 minute.
# Attach these labels to any time series or alerts when communicating with # Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager). # external systems (federation, remote storage, Alertmanager).
@ -19,11 +19,11 @@ rule_files:
# Here it's Prometheus itself. # Here it's Prometheus itself.
scrape_configs: scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: '{{ prometheus_server_job_name | default("prometheus") }}' - job_name: '{{ prometheus_server_job_name }}'
# Override the global default and scrape targets from this job every 5 seconds. # Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: {{ prometheus_server_scrape_interval | default(5) }}s scrape_interval: {{ prometheus_server_scrape_interval }}s
scrape_timeout: {{ prometheus_server_scrape_timeout | default(5) }}s scrape_timeout: {{ prometheus_server_scrape_timeout }}s
# metrics_path defaults to '/metrics' # metrics_path defaults to '/metrics'
# scheme defaults to 'http'. # scheme defaults to 'http'.

View File

@ -4,7 +4,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User={{ prometheus_postgres_exporter_user|default("postgres") }} User={{ prometheus_postgres_exporter_user }}
ExecStart=/usr/local/bin/prometheus-postgres-exporter ExecStart=/usr/local/bin/prometheus-postgres-exporter
EnvironmentFile=/etc/default/prometheus-postgres-exporter EnvironmentFile=/etc/default/prometheus-postgres-exporter