library/roles/prometheus-node-exporter: Playbook that installs the prometheus node exporter.

This commit is contained in:
Andrea Dell'Amico 2018-01-16 19:46:47 +01:00
parent 95994651bd
commit e87c940ab8
4 changed files with 8 additions and 4 deletions

View File

@ -3,7 +3,7 @@ prometheus_n_e_install: True
prometheus_n_e_version: 0.15.2
prometheus_n_e_dir: 'node_exporter-{{ prometheus_n_e_version }}.linux-amd64'
prometheus_n_e_file: '{{ prometheus_n_e_dir }}.tar.gz'
prometheus_n_e_download_url: 'https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_n_e_version }}/{{ prometheus_n_e_file }}'
prometheus_n_e_download_url: 'https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_n_e_version }}/{{ prometheus_n_e_file }}'
prometheus_n_e_user: prometheus
prometheus_n_e_home: /opt/prometheus
prometheus_n_e_dist_dir: '{{ prometheus_n_e_home }}/dist'
@ -11,6 +11,6 @@ prometheus_n_e_logdir: '/var/log/prometheus-node-exporter'
prometheus_n_e_cmd: '{{ prometheus_n_e_dist_dir }}/{{ prometheus_n_e_dir }}/node_exporter'
prometheus_n_e_port: 9100
prometheus_n_e_loglevel: info
prometheus_n_e_opts: '--web.listen-address=":{{ prometheus_n_e_port }} --log.level={{ prometheus_n_e_loglevel }}'
prometheus_n_e_opts: '--web.listen-address=":{{ prometheus_n_e_port }}" --log.level={{ prometheus_n_e_loglevel }}'
# List the additional options here
prometheus_n_e_additional_opts: ''

View File

@ -1,3 +1,7 @@
---
- name: systemd reload
command: systemctl daemon-reload
- name: Restart node exporter
service: name=node_exporter state=restarted

View File

@ -16,7 +16,7 @@
get_url: url={{ prometheus_n_e_download_url }} dest=/srv/
- name: Unarchive the prometheus distribution
unarchive: src=/srv/{{ prometheus_n_e_file }} dest={{ prometheus_n_e_dist_dir }} remote_src=yes
unarchive: src=/srv/{{ prometheus_n_e_file }} dest={{ prometheus_n_e_dist_dir }} remote_src=yes owner=root group=root
args:
creates: '{{ prometheus_n_e_dist_dir }}/{{ prometheus_n_e_dir }}/node_exporter'
notify: Restart node exporter

View File

@ -8,5 +8,5 @@ setuid {{ prometheus_n_e_user }}
setgid {{ prometheus_n_e_user }}
script
exec {{ prometheus_n_e_cmd }} {{ prometheus_n_e_opts }} {{ prometheus_n_e_additional_opts }} > {{ prometheus_n_e_logdir }}/node_exporter.log 2>&1
exec {{ prometheus_n_e_cmd }} {{ prometheus_n_e_opts }} {{ prometheus_n_e_additional_opts }} > {{ prometheus_n_e_logdir }}/node_exporter.log 2>&1
end script