-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
70 lines (61 loc) · 1.65 KB
/
playbook.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
69
70
---
- name: Install Node Exporter
hosts: servidores
become: true
become_user: root
tasks:
- name: Create group node_exporter
ansible.builtin.group:
name: nodeexporter
state: present
system: true
- name: Create user node_exporter
ansible.builtin.user:
name: nodeexporter
shell: /bin/nologin
system: true
group: nodeexporter
- name: download node exporter
get_url:
url: https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
dest: /tmp
- name: Unzip node exporter
unarchive:
remote_src: yes
src: /tmp/node_exporter-1.8.2.linux-amd64.tar.gz
dest: /tmp
- name: move node exporter to /usr/local/bin
copy:
src: /tmp/node_exporter-1.8.2.linux-amd64/node_exporter
dest: /usr/local/bin/node_exporter
remote_src: yes
owner: nodeexporter
group: nodeexporter
mode: 0755
- name: Create auth file
file:
path: /etc/nodeexporter
state: directory
owner: nodeexporter
group: nodeexporter
mode: 0755
- name: Send auth file
template:
src: service_systemd/.htpasswd
dest: /etc/nodeexporter/.htpasswd
owner: nodeexporter
group: nodeexporter
mode: 0755
- name: install unit file to systemd
template:
src: service_systemd/node_exporter.service
dest: /etc/systemd/system/node_exporter.service
owner: nodeexporter
group: nodeexporter
mode: 0600
- name: configure systemd to use service
systemd:
daemon_reload: yes
enabled: yes
state: started
name: node_exporter.service