浏览代码

Issue #214: Uncommented slurm exporter task

Signed-off-by: K <Deepika_K2@Dell.com>
K 4 年之前
父节点
当前提交
3d25c3ea25
共有 3 个文件被更改,包括 34 次插入8 次删除
  1. 6 6
      omnia.yml
  2. 27 2
      roles/slurm_exporter/tasks/configure_prometheus_pod.yml
  3. 1 0
      roles/slurm_manager/vars/main.yml

+ 6 - 6
omnia.yml

@@ -118,9 +118,9 @@
     - slurm_start_services
   tags: slurm
 
-#- name: Install slurm exporter
-# hosts: manager
-# gather_facts: false
-# roles:
-#   - slurm_exporter
-# tags: slurm
+- name: Install slurm exporter
+  hosts: manager
+  gather_facts: false
+  roles:
+    - slurm_exporter
+  tags: slurm

+ 27 - 2
roles/slurm_exporter/tasks/configure_prometheus_pod.yml

@@ -13,6 +13,31 @@
 #  limitations under the License.
 ---
 
+- name: Copy the slurm exporter config file
+  copy:
+    src: "{{ slurm_config_file }}"
+    dest: "{{ installation_dir }}"
+    owner: root
+    group: root
+    mode: "{{ file_permission }}"
+
+- name: Add the host IP to config file
+  lineinfile:
+    dest: "{{ installation_dir }}/{{ slurm_config_file }}"
+    regexp: "http:"
+    insertafter: "- targets"
+    line: "        - http://{{ inventory_hostname }}:8080/metrics"
+    state: present
+    backup: yes
+    backrefs: yes
+
+- name: Verify if slurm exporter is already configured
+  command: kubectl get service prometheus-slurmexporter-metrics-2
+  register: service_status
+  changed_when: False
+  ignore_errors: yes
+
 - name: Apply slurm exporter configuration to prometheus
-  command: kubectl apply -f "{{ role_path }}/files/{{ slurm_config_file }}" --validate=false
-  changed_when: False
+  command: kubectl apply -f "{{ installation_dir }}/{{ slurm_config_file }}" --validate=false
+  changed_when: true
+  when: "'Error from server (NotFound)' in service_status.stderr"

+ 1 - 0
roles/slurm_manager/vars/main.yml

@@ -25,6 +25,7 @@ slurm_packages:
    - perl-DBI
    - perl-Switch
    - libibumad
+   - git
 
 dev_tools:
    - rrdtool-devel