Role name in Ansible Galaxy: William-Yeh.consul_exporter
This Ansible role has the following features for consul_exporter (a Consul metrics exporter for Prometheus):
- Install specific versions of consul_exporter;
- Install by compiling from the master repo;
- Handlers for restart/reload/stop events.
NOTE: If you want to install Prometheus itself or other exporters, see williamyeh.prometheus for more info.
None.
Install specific version of Consul exporter (a little bit outdated; I hope the maintainer of consul_exporter will provide more recent binary releases):
# default version
prometheus_consul_exporter_version: 0.2.0
Or, you can optionally download/compile from the master branch of consul_exporter by setting the respective version to git
:
prometheus_consul_exporter_version: git
It will install a temporary Golang compiler in the prometheus_workdir
directory (defined in defaults/main.yml
). If you'd like to force rebuild each time, enable the following variable (default is false
):
prometheus_rebuild: true
Additional command-line arguments, if any (use consul_exporter --help
to see the full list of arguments):
prometheus_consul_exporter_opts
If the Linux distributions are equipped with systemd, this role will use this mechanism accordingly. You can disable this (i.e., use traditional SysV-style init script) by defining the variable to false: prometheus_consul_exporter_use_systemd: false
.
prometheus_consul_exporter_use_systemd
This section lists all variables common for all Prometheus servers and exporters. You may have seen them in my williamyeh.prometheus role.
User-configurable defaults:
# user and group
prometheus_user: prometheus
prometheus_group: prometheus
# directory for executable files
prometheus_install_path: /opt/prometheus
# directory for logs
prometheus_log_path: /var/log/prometheus
# directory for PID files
prometheus_pid_path: /var/run/prometheus
# directory for temporary files
prometheus_download_path: /tmp
# version of helper utility "gosu"
gosu_version: 1.9
-
restart consul_exporter
-
reload consul_exporter
-
stop consul_exporter
Add role name William-Yeh.consul_exporter
to your playbook file.
Set vars in your playbook file, if necessary.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
become: True
roles:
- William-Yeh.consul_exporter
vars:
prometheus_consul_exporter_opts: "-log.level=debug"
None.
- William Yeh
- Robbie Trencheny - contribute an early version of building binaries from Go source code.
- Travis Truman - contribute an early version of this role.
- Musee Ullah - test with
savagegus.consul
role.
MIT License. See the LICENSE file for details.