From 95b73daa36b23565a8566f71f9b202d3459b685f Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 25 Jun 2023 09:52:36 -0400 Subject: Initial Commit --- .../prometheus/node_exporter/defaults/main.yml | 4 ++++ .../prometheus/node_exporter/tasks/main.yml | 28 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 roles/services/monitoring/prometheus/node_exporter/defaults/main.yml create mode 100644 roles/services/monitoring/prometheus/node_exporter/tasks/main.yml (limited to 'roles/services/monitoring/prometheus/node_exporter') diff --git a/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml b/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml new file mode 100644 index 0000000..e4ff351 --- /dev/null +++ b/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml @@ -0,0 +1,4 @@ +node_exporter_debian_package: prometheus-node-exporter +node_exporter_fedora_package: golang-github-prometheus-node-exporter +prometheus_server_ip: 192.168.88.32 +node_exporter_port: '9100' diff --git a/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml b/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml new file mode 100644 index 0000000..6bbcc08 --- /dev/null +++ b/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml @@ -0,0 +1,28 @@ +- name: install package (Debian) + when: ansible_facts['distribution'] == "Debian" + package: + name: "{{ node_exporter_debian_package }}" + +- name: install package (Fedora) + when: ansible_facts['distribution'] == "Fedora" + package: + name: "{{ node_exporter_fedora_package }}" + +- name: allow port + ufw: + rule: allow + direction: in + proto: tcp + src: "{{ prometheus_server_ip }}" + to_port: "{{ node_exporter_port }}" + +- name: enable service + systemd: + name: prometheus-node-exporter + enabled: yes + masked: no + +- name: restart service + service: + name: prometheus-node-exporter + state: restarted -- cgit v1.2.3