diff --git a/roles/prometheus-node/handlers/main.yml b/roles/prometheus-node/handlers/main.yml new file mode 100644 index 0000000..b4b64a4 --- /dev/null +++ b/roles/prometheus-node/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart prometheus-node-exporter + service: + name: prometheus-node-exporter + state: restarted diff --git a/roles/prometheus-node/tasks/main.yml b/roles/prometheus-node/tasks/main.yml index 15c12b3..92149b7 100644 --- a/roles/prometheus-node/tasks/main.yml +++ b/roles/prometheus-node/tasks/main.yml @@ -6,3 +6,10 @@ register: apt_result retries: 3 until: apt_result is succeeded + +- name: Make Prometheus node-exporter listen on adm only + lineinfile: + path: /etc/default/prometheus-node-exporter + regexp: '^ARGS=' + line: "ARGS=\"--web.listen-address={{ ansible_fqdn }}:9100\"" + notify: Restart prometheus-node-exporter