Browse Source

Merge pull request #233 from DeepikaKrishnaiah/devel

Issue #232: Configure slurm exporter job on prometheus with public IP
Lucas A. Wilson 4 years ago
parent
commit
6a6cd9eb79
1 changed files with 6 additions and 1 deletions
  1. 6 1
      roles/k8s_start_services/tasks/main.yml

+ 6 - 1
roles/k8s_start_services/tasks/main.yml

@@ -108,11 +108,16 @@
     group: root
     mode: "{{ slurm_exporter_file_mode }}"
 
+- name: Fetch the public IP of the host
+  shell: ip route get 8.8.8.8 | awk '{print $7}'
+  register: public_ip
+  changed_when: False
+
 - name: Add the host IP to config file
   replace:
     path: "{{ slurm_exporter_config_file_path }}{{ slurm_exporter_config_file }}"
     regexp: "localhost"
-    replace: "{{ inventory_hostname }}"
+    replace: "{{ public_ip.stdout }}"
   tags: init
 
 - name: Prometheus deployment