blob: dc222e3ec595ce90d36a7f3e15a4f80659bd30ce (
plain) (
blame)
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
|
---
- name: "Include OS-specific variables"
ansible.builtin.include_vars: "{{ ansible_facts['os_family'] | lower }}.yml"
- name: "Ensure prometheus-node-exporter is installed"
become: true
ansible.builtin.package:
name: "prometheus-node-exporter"
state: "present"
- name: "Configure node-exporter host/port via environment file"
become: true
ansible.builtin.copy:
content: |
NODE_EXPORTER_ARGS="
--web.listen-address={{ node_exporter_host }}:{{ node_exporter_port }}
--collector.systemd
"
dest: "{{ node_exporter_env_file }}"
mode: "0644"
notify: "Restart node-exporter"
- name: "Start and enable prometheus-node-exporter"
become: true
ansible.builtin.systemd_service:
name: "prometheus-node-exporter"
state: "started"
enabled: true
|