-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prometheus node exporter to ubuntu hosts
- Loading branch information
1 parent
ee3cbb1
commit 01b5cad
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
basic_auth_users: | ||
prometheus: $2y$05$tarSVOn5jRue/nCuXooDNOaSwFWfG25DE.YuNwMZ.H4siiDEyEtEy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- name: Install node exporter | ||
ansible.builtin.apt: | ||
name: prometheus-node-exporter | ||
state: present | ||
install_recommends: false | ||
|
||
- name: Make node exporter config directory | ||
file: | ||
path: /etc/node_exporter | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
|
||
- name: Deploy node exporter web config | ||
ansible.builtin.copy: | ||
src: node_exporter_config.yml | ||
dest: /etc/node_exporter/config.yml | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
notify: | ||
- Restart prometheus node exporter | ||
|
||
- name: Modify node exporter defaults config | ||
ansible.builtin.lineinfile: | ||
path: /etc/default/prometheus-node-exporter | ||
regexp: "^ARGS=" | ||
line: ARGS="--web.config='/etc/node_exporter/config.yml'" | ||
state: present | ||
notify: | ||
- Restart prometheus node exporter | ||
|
||
- name: Setup prometheus node exporter service | ||
ansible.builtin.service: | ||
name: prometheus-node-exporter | ||
state: started | ||
enabled: true |