Ansible role: Prometheus exporters

Install and configure Prometheus exporters
Requirements
Role variables
| Name |
Type |
Required |
Default |
Comment |
| prometheus_exports |
dict |
no |
|
exporters with config |
prometheus_exports
| Name |
Type |
Required |
Default |
Comment |
| key |
str |
yes |
|
exporter name |
| env |
dict |
no |
|
environment variables |
| file |
dict |
no |
|
config file |
| state |
str |
no |
present |
if absent, uninstall exporter |
Example:
node:
env:
ARGS:
- "--collector.filesystem.mount-points-exclude=/test"
- "--collector.systemd.unit-exclude=prometheus"
mysql:
file:
path: "/var/lib/prometheus/.my.cnf"
content: |-
[client]
database=mysql
user=username
host=localhost
password=secret
prometheus_exports.env
| Name |
Type |
Required |
Default |
Comment |
| key |
str |
yes |
|
environment variable name |
| value |
str or list |
yes |
|
value of environment variable |
prometheus_exports.file
| Name |
Type |
Required |
Default |
Comment |
| path |
str |
yes |
|
config file path |
| content |
str |
yes |
|
content of config file |
How to use
- hosts: server
roles:
- prometheus_exports
Development
Test with molecule and docker
- install docker
- install
python3 and python3-pip
- install molecule and dependencies
pip3 install molecule molecule-plugins ansible-lint pytest-testinfra yamllint
- run
molecule test
License
Copyright (c) 2019 Adrien Waksberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.