-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmongodb-exporter.yml
63 lines (50 loc) · 1.23 KB
/
mongodb-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
---
- hosts: all
vars:
install_dir: "/opt/prometheus/mongodb_exporter"
download_link: "https://github.com/percona/mongodb_exporter/releases/download/v0.11.0/mongodb_exporter-0.11.0.linux-amd64.tar.gz
"
user: "prometheus"
group: "prometheus"
uid: "1555"
gid: "1555"
tasks:
- name: create directory
file:
dest: "{{ item }}"
state: directory
mode: 0755
recurse: yes
with_items:
- "{{ install_dir }}"
- unarchive:
src: "{{ download_link }}"
dest: "{{ install_dir }}"
remote_src: True
- 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/mongod_exporter.service.j2
dest: /etc/systemd/system/mongod_exporter.service
- name: setup systemctl service
template:
src: templates/mongod_env.j2
dest: "{{ install_dir }}/env"
mode: '600'
owner: "{{user}}"
group: "{{group}}"
- name: restart service
systemd:
name: mongod_exporter
enabled: yes
state: restarted
daemon_reload: yes