2017-12-05 05:58:34 +01:00
|
|
|
# Install Prometheus node-exporter.
|
|
|
|
#
|
|
|
|
# @see http://prometheus.io/docs/introduction/getting_started/
|
|
|
|
|
|
|
|
- name: set internal variables for convenience
|
|
|
|
set_fact:
|
2018-09-14 12:56:04 +02:00
|
|
|
node_exporter_present: yes
|
2017-12-05 05:58:34 +01:00
|
|
|
node_exporter_daemon_dir: "{{ prometheus_install_path }}/node_exporter-{{ node_exporter_version }}.linux-amd64"
|
|
|
|
node_exporter_tarball_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz"
|
|
|
|
|
|
|
|
- name: download and untar node_exporter tarball
|
|
|
|
unarchive:
|
|
|
|
src: "{{ node_exporter_tarball_url }}"
|
|
|
|
dest: "{{ prometheus_install_path }}"
|
|
|
|
copy: no
|
|
|
|
creates: "{{ node_exporter_daemon_dir }}"
|
|
|
|
|
|
|
|
- name: create node_exporter /usr/local/bin link
|
|
|
|
file:
|
|
|
|
src: "{{ node_exporter_daemon_dir }}/node_exporter"
|
|
|
|
dest: "/usr/local/bin/node_exporter"
|
|
|
|
state: link
|
|
|
|
|
|
|
|
- name: mkdir for data
|
|
|
|
file:
|
|
|
|
path: "{{ prometheus_db_path }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ prometheus_user }}"
|
|
|
|
group: "{{ prometheus_group }}"
|
|
|
|
mode: "u=rwx,g=rx,o="
|
|
|
|
|
|
|
|
- name: copy systemd config to server
|
|
|
|
template:
|
|
|
|
src: "../templates/node_exporter.service.j2"
|
|
|
|
dest: "/lib/systemd/system/node_exporter.service"
|
2018-09-11 14:11:20 +02:00
|
|
|
notify:
|
|
|
|
- reload systemd
|
|
|
|
- restart node_exporter
|
2017-12-05 05:58:34 +01:00
|
|
|
|
|
|
|
- name: enable node_exporter service
|
|
|
|
service:
|
|
|
|
name: node_exporter
|
|
|
|
enabled: yes
|
|
|
|
state: started
|