summaryrefslogtreecommitdiffstats
path: root/roles/prometheus/tasks/main.yml
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-17 14:01:03 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-17 14:01:03 +0200
commitd31f8f49f99397a676aa35b1f368339dc49fe54f (patch)
tree80614af56b93ae9f1b13c3ff9ee84bbe8d7f7c84 /roles/prometheus/tasks/main.yml
parentd7c3044edf15ca2ee8a8bcc2fcdce8e26e4133d9 (diff)
Fix prometheus/node-exporter starting on configured port
Diffstat (limited to 'roles/prometheus/tasks/main.yml')
-rw-r--r--roles/prometheus/tasks/main.yml20
1 files changed, 20 insertions, 0 deletions
diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml
index 9feeacaf..7b713581 100644
--- a/roles/prometheus/tasks/main.yml
+++ b/roles/prometheus/tasks/main.yml
@@ -44,6 +44,26 @@
mode: "0644"
notify: "Restart prometheus"
+# NOTE: show systemd configurations using: systemctl cat prometheus
+- name: "Configure prometheus port via environment file"
+ become: true
+ ansible.builtin.copy:
+ content: |
+ PROMETHEUS_ARGS="--web.listen-address=0.0.0.0:{{ prometheus_port }}"
+ dest: "/etc/conf.d/prometheus"
+ mode: "0644"
+ notify: "Restart prometheus"
+
+# NOTE: show systemd configurations using: systemctl cat prometheus-node-exporter
+- name: "Configure node-exporter port via environment file"
+ become: true
+ ansible.builtin.copy:
+ content: |
+ NODE_EXPORTER_ARGS="--web.listen-address=:{{ prometheus_node_exporter_port }}"
+ dest: "/etc/conf.d/prometheus-node-exporter"
+ mode: "0644"
+ notify: "Restart node-exporter"
+
- name: "Start and enable prometheus services"
become: true
ansible.builtin.systemd_service: