-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnode_exporter.yml
49 lines (43 loc) · 1.15 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
---
- name: fix node_exporter user
become: true
user:
name: prometheus
state: present
- name: download node_exporter
become: true
unarchive:
src: 'https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz'
dest: /opt/
owner: prometheus
group: prometheus
mode: 0755
remote_src: yes
- name: create a link for node_exporter
become: true
file:
src: '/opt/node_exporter-0.18.1.linux-amd64'
dest: /opt/node_exporter
state: link
- name: copy systemd templates
become: true
copy:
src: node_exporter/node_exporter.service
dest: /etc/systemd/system/node_exporter.service
force: yes
owner: root
group: root
mode: 0644
- name: exec systemd
become: true
systemd:
name: node_exporter
state: restarted
daemon_reload: yes
enabled: true
- name: check hw
shell: if [ "$(ps axu | grep node_exporter | grep -v grep)" != "" ]; then echo "true"; else echo "false"; fi
register: check
- name: failed if not work
fail:
when: check.stdout == "false"