forked from ISTI-ansible-roles/ansible-roles
library/roles/prometheus-node-exporter: Playbook that installs the prometheus node exporter.
This commit is contained in:
parent
95994651bd
commit
e87c940ab8
|
@ -3,7 +3,7 @@ prometheus_n_e_install: True
|
||||||
prometheus_n_e_version: 0.15.2
|
prometheus_n_e_version: 0.15.2
|
||||||
prometheus_n_e_dir: 'node_exporter-{{ prometheus_n_e_version }}.linux-amd64'
|
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_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_user: prometheus
|
||||||
prometheus_n_e_home: /opt/prometheus
|
prometheus_n_e_home: /opt/prometheus
|
||||||
prometheus_n_e_dist_dir: '{{ prometheus_n_e_home }}/dist'
|
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_cmd: '{{ prometheus_n_e_dist_dir }}/{{ prometheus_n_e_dir }}/node_exporter'
|
||||||
prometheus_n_e_port: 9100
|
prometheus_n_e_port: 9100
|
||||||
prometheus_n_e_loglevel: info
|
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
|
# List the additional options here
|
||||||
prometheus_n_e_additional_opts: ''
|
prometheus_n_e_additional_opts: ''
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: systemd reload
|
- name: systemd reload
|
||||||
command: systemctl daemon-reload
|
command: systemctl daemon-reload
|
||||||
|
|
||||||
|
- name: Restart node exporter
|
||||||
|
service: name=node_exporter state=restarted
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
get_url: url={{ prometheus_n_e_download_url }} dest=/srv/
|
get_url: url={{ prometheus_n_e_download_url }} dest=/srv/
|
||||||
|
|
||||||
- name: Unarchive the prometheus distribution
|
- 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:
|
args:
|
||||||
creates: '{{ prometheus_n_e_dist_dir }}/{{ prometheus_n_e_dir }}/node_exporter'
|
creates: '{{ prometheus_n_e_dist_dir }}/{{ prometheus_n_e_dir }}/node_exporter'
|
||||||
notify: Restart node exporter
|
notify: Restart node exporter
|
||||||
|
|
|
@ -8,5 +8,5 @@ setuid {{ prometheus_n_e_user }}
|
||||||
setgid {{ prometheus_n_e_user }}
|
setgid {{ prometheus_n_e_user }}
|
||||||
|
|
||||||
script
|
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
|
end script
|
||||||
|
|
Loading…
Reference in New Issue