-
Notifications
You must be signed in to change notification settings - Fork 1
/
node_exporter.yml
72 lines (56 loc) · 1.65 KB
/
node_exporter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
- hosts: all
vars:
install_dir: "/opt/prometheus/node_exporter"
node_exporter_version: "1.0.1"
download_link: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz"
user: "prometheus"
group: "prometheus"
shell: "/sbin/nologin"
log_dir: "/var/log/prometheus"
uid: "1555"
gid: "1555"
tasks:
- name: create directory
file:
dest: "{{ item }}"
state: directory
mode: 0755
recurse: yes
with_items:
- "{{ install_dir }}"
- "{{ log_dir }}"
- unarchive:
src: "{{ download_link }}"
dest: "{{ install_dir }}"
remote_src: True
- file:
src: "{{ install_dir }}/node_exporter-{{ node_exporter_version }}.linux-amd64//node_exporter"
dest: "{{ install_dir }}/node_exporter"
state: link
- name: add group
group:
name: "{{ group }}"
state: present
gid: "{{ gid }}"
- name: add user
user:
name: "{{ user }}"
group: "{{ group }}"
uid: "{{ uid }}"
- name: setup systemctl service
template:
src: templates/node_exporter.service.j2
dest: /etc/systemd/system/node_exporter.service
#when: (ansible_distribution_major_version == "7" and ansible_distribution == "CentOS")
- name: setup init
template:
src: templates/node_exporter.init.j2
dest: /etc/init.d/node_exporter
mode: 0755
when: ansible_distribution_major_version == "6" and ansible_distribution == "CentOS"
- name: restart service
service:
name: node_exporter
enabled: yes
state: restarted