cogini.prometheus-rpm
Install Prometheus
Summary
This Ansible role helps you install Prometheus components using RPM packages from https://packagecloud.io/app/prometheus-rpm.
For the source code used to create these packages, visit https://github.com/lest/prometheus-rpm.
This role takes care of installing Prometheus and configuring command line settings for its daemons. For simple exporters, this role is sufficient. However, for more complex components like Prometheus itself, you will need to create configuration files with a different role.
Role Variables
By default, this role does not install anything. You need to set prometheus_rpm_components
to specify
which components you want to install.
For a server, you might configure it like this:
prometheus_rpm_components:
- alertmanager
- blackbox_exporter
# - prometheus # Prometheus 1.x
- prometheus2 # Prometheus 2.x
- sachet
For different types of exporters, you can use:
prometheus_rpm_components:
- apache_exporter
- collectd_exporter
- consul_exporter
- elasticsearch_exporter
- graphite_exporter
- haproxy_exporter
- jmx_exporter
- mysqld_exporter
- node_exporter
- postgres_exporter
- pushgateway
- redis_exporter
- snmp_exporter
You can also set variables to adjust the command line options, which will replace the default options in the /etc/default
file used by the systemd unit.
prometheus_rpm_alertmanager_opts: ""
prometheus_rpm_blackbox_exporter_opts: ""
prometheus_rpm_prometheus_opts: '--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data'
prometheus_rpm_sachet_exporter_opts: "-config /etc/prometheus/sachet.yml"
prometheus_rpm_apache_exporter_opts: "--config.file /etc/prometheus/blackbox.yml"
prometheus_rpm_collectd_opts: ""
prometheus_rpm_consul_exporter_opts: ""
prometheus_rpm_elasticsearch_exporter_opts: ""
prometheus_rpm_graphite_exporter_opts: ""
prometheus_rpm_haproxy_exporter_opts: ""
prometheus_rpm_jmx_exporter_opts: ""
prometheus_rpm_mysqld_exporter_opts: ""
prometheus_rpm_node_exporter_opts: ""
prometheus_rpm_postgres_exporter_opts: ""
prometheus_rpm_postgres_exporter_data_source_name: ""
prometheus_rpm_postgres_exporter_data_source_uri: ""
prometheus_rpm_postgres_exporter_data_source_user: ""
prometheus_rpm_postgres_exporter_data_source_user_file: ""
prometheus_rpm_postgres_exporter_data_source_pass: ""
prometheus_rpm_postgres_exporter_data_source_pass_file: ""
prometheus_rpm_pushgateway_opts: ""
prometheus_rpm_redis_exporter_opts: ""
prometheus_rpm_snmp_exporter_opts: ""
By default, this role installs packages but does not update them to newer versions.
prometheus_rpm_package_state: present
If you want to upgrade packages on an existing system, set this to latest
. You can run a command like this:
ansible-playbook my-servers playbooks/foo.yml --extra-vars ansible_become=latest
License
Apache 2.0
Author
Written by Jake Morrison from Cogini
ansible-galaxy install cogini.prometheus-rpm