Role name in Ansible Galaxy: williamyeh.mongodb_exporter
This Ansible role has the following features for mongodb_exporter (a MongoDB metrics exporter for Prometheus):
- Install mongodb_exporter by compiling its Golang source code (I hope the maintainer of mongodb_exporter will provide official binary releases).
- Handlers for restart/reload/stop events.
NOTE: If you want to install Prometheus itself or other exporters, see williamyeh.prometheus for more info.
None.
Mongodb_exporter specific user-configurable defaults:
# MongoDB Connection String URI
# @see http://docs.mongodb.org/manual/reference/connection-string/
mongodb_exporter_mongodb_uri: "mongodb://localhost:27017"
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: mongodb_exporter_use_systemd: false
.
mongodb_exporter_use_systemd
Prometheus user-configurable defaults (of course, a subset of optional variables in williamyeh.prometheus):
# 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
# version of helper utility "gosu"
gosu_version: 1.9
-
restart mongodb_exporter
-
reload mongodb_exporter
-
stop mongodb_exporter
Add role name williamyeh.mongodb_exporter
to your playbook file.
Set vars in your playbook file, if necessary.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
become: True
roles:
- williamyeh.mongodb_exporter
vars:
mongodb_exporter_mongodb_uri: "mongodb://adm:password@localhost:27017"
None.
MIT License. See the LICENSE file for details.