---
# This should be your prometheus host as it is defined in your ansible
# inventory. This is where all the target files specified in the exporters
# `path` should exist. The host is used for the delegated tasks in this role.
# ---
# prometheus_target_host:
# This is the strategy that is used for adding hosts.
# See readme for more info on the individual strategies.
prometheus_target_strategy: lineinfile
################################################################################
# Handler configuration
################################################################################
# On the change of any target file the command and the shell handler will be
# triggered. You can use this to reload your prometheus instance, commit target
# changes somewhere, ...
# This variable enables the command handler. Make sure to also provide the
# necessary configuration in prometheus_target_handler_command
prometheus_target_handler_command_enabled: false
# By default the target command handler will be run with root privileges on the
# prometheus host. This is useful if you want to send a signal to the prometheus
# host to trigger a reload. In other instances, for example if you reload the
# instance with a curl command, or ssh with the prometheus user, this may not be
# necessary.
prometheus_target_handler_command_become: true
# prometheus_target_handler_command_become_method:
# prometheus_target_handler_command_become_user:
# By default the target handler will run for every host added on the delegated
# host. This means that if you add 20 hosts as your target, you will run the
# handler 20 times on your delegated host. This is useful if you need some host
# specific variables to run on the delegated host however often times, such as
# when using it to create a commit in a repository, you only need to do it once
# per run and not per host.
prometheus_target_handler_command_run_once: false
# This is the configuration for the command module. For documentation see:
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html
# ---
# prometheus_target_handler_command:
# argv:
# chdir:
# cmd:
# creates:
# free_form:
# removes:
# stdin:
# stdin_add_newline:
# This is the same as the prometheus_target_handler_command settings but uses
# the ansible shell module. You might want to consider using this if you require
# things such as environment variables in the handler.
prometheus_target_handler_shell_enabled: false
# This will configure if the shell handler is run with root privileges or not.
# See documentation for prometheus_target_handler_command_become above.
prometheus_target_handler_shell_become: true
# prometheus_target_handler_shell_become_method:
# prometheus_target_handler_shell_become_user:
# This will configure the shell handler to run once.
# See documentation for prometheus_target_handler_command_run_once above.
prometheus_target_handler_shell_run_once: false
# This is the configuration for the shell module. For documentation see:
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html
# ---
# prometheus_target_handler_shell:
# chdir:
# cmd:
# creates:
# executable:
# free_form:
# removes:
# stdin:
# stdin_add_newline:
################################################################################
# lineinfile strategy configuration
################################################################################
# You can use these 2 settings to prefix / suffix all of your exporters.
# With the yaml target configurations you might have target files like this:
# ---
# - targets:
# - target_1
# - target_2
# ...
# This configuration is mostly used for globally indenting all of your targets
# in their target configuration and thus keeping this configuration away from
# the exporter host variable.
prometheus_target_strategy_lineinfile_prefix: ' - '
prometheus_target_strategy_lineinfile_suffix: ''
################################################################################
# Exporter configuration
################################################################################
# You can configure a target prefix to keep your targets in your exporters
# configuration. DRY For example if all your target files reside in
# /opt/prometheus it's a good idea to set the prefix to /opt/prometheus/ so that
# you can define your remaining target files as just target.yml instead of
# /opt/prometheus/target.yml
# In case you have a few exporters that reside in different directories you may
# ignore the prefix by specifying `path_prefix: ''` in the exporter default
# or the enabled exporter config.
prometheus_target_exporter_target_prefix: ''
# This will configure the default settings for specified exporters.
# The key in this dict should map to the possible id in the specified exporter
# in prometheus_target_exporter or prometheus_target_default_exporters.
# The settings specified in prometheus_target_exporter will supersede the ones
# here. It is recommended to specify the defaults for all exporters in use since
# usually the path / host parameters can be auto generated from variables and
# static information such as the port the exporter usually runs on.
# Ideally the only thing you should specify on the role level is the id, i.e.
# the exporter you want to enable, to keep a clean configuration.
prometheus_target_exporter_defaults: {}
# node_exporter:
# path: /opt/prometheus/targets.yml
# host: '{{ inventory_hostname }}:9100'
# blackbox_exporter:
# path: /opt/targets/blackbox.yml
# host: 'https://{{ hostvars[inventory_hostname].ansible_host }}'
# path_prefix: ''
# This is where you specify the exporters that should be deployed to prometheus.
# You should configure this on a per play basis. If you wish to configure
# exporters that are added on every play i.e. default exporters see the
# prometheus_target_default_exporters variable below.
prometheus_target_exporter: []
# - id: node_exporter
# # overwrites prometheus_target_exporter_defaults.node_exporter.path
# path: /path/to/targets/file/on/prometheus/host
# # overwrites: prometheus_target_exporter_defaults.node_exporter.host
# host: '{{ inventory_hostname }}:9100'
# This is a list of exporters that will be appended to the
# prometheus_target_exporter variable. duplicate exporters in
# prometheus_target_exporter and prometheus_target_default_exporters will be
# ignored.
prometheus_target_default_exporters: []
# - { id: node_exporter }
# - { id: blackbox_exporter, path: /path/to/target, path_prefix: '' }
# You can enable this variable to not add exporters defined in
# prometheus_target_default_exporters
prometheus_target_skip_default_exporters: false