浏览代码

Issue #402: Slurm exporter port change

Signed-off-by: DeepikaKrishnaiah <deepika_k2@dell.com>
Lucas A. Wilson 3 年之前
父节点
当前提交
38732260f3

+ 1 - 1
README.md

@@ -24,7 +24,7 @@ For Omnia documentation, including installation and contribution instructions, p
 <img src="docs/images/pisa.png" height="100px" alt="Universita di Pisa"> <img src="https://user-images.githubusercontent.com/83095575/117071024-64956c80-ace3-11eb-9d90-2dac7daef11c.png" height="80px" alt="Arizona State University"> <img src="https://www.vizias.com/uploads/1/1/8/9/118906653/published/thick-blue-white-ring-letters-full.png" height="60px" alt="Vizias">
 
 ## Contributors
-Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+Thanks goes to everyone who makes Omnia possible ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
 <!-- prettier-ignore-start -->
 <!-- markdownlint-disable -->

+ 5 - 2
roles/k8s_start_services/tasks/main.yml

@@ -13,6 +13,9 @@
 #  limitations under the License.
 ---
 
+- name: Include common variables
+  include_vars: ../../slurm_exporter/vars/main.yml
+
 - name: Wait for CoreDNS to restart
   command: kubectl rollout status deployment/coredns -n kube-system
   changed_when: false
@@ -147,8 +150,8 @@
 - name: Add the host IP to config file
   replace:
     path: "{{ slurm_exporter_config_file_path }}{{ slurm_exporter_config_file }}"
-    regexp: "localhost"
-    replace: "{{ public_ip.stdout }}"
+    regexp: "localhost:8080"
+    replace: "{{ public_ip.stdout }}:{{ slurm_exporter_port }}"
   tags: init
 
 - name: Prometheus deployment

+ 1 - 1
roles/slurm_exporter/files/prometheus-slurm-exporter.service

@@ -2,7 +2,7 @@
 Description = Start prometheus slurm exporter
 
 [Service]
-ExecStart = /usr/bin/prometheus-slurm-exporter
+ExecStart = /usr/bin/prometheus-slurm-exporter "--listen-address=0.0.0.0:8080"
 Restart = always
 RestartSec = 15
 

+ 1 - 1
roles/slurm_exporter/tasks/install_prometheus.yml

@@ -37,4 +37,4 @@
           scrape_interval:  30s
           scrape_timeout:   30s
           static_configs:
-            - targets: ['localhost:8080']
+            - targets: ['localhost:{{ slurm_exporter_port }}']

+ 23 - 0
roles/slurm_exporter/tasks/start_services.yml

@@ -13,6 +13,22 @@
 # limitations under the License.
 ---
 
+- name: Firewall port addition for slurm exporter
+  firewalld:
+    zone: public
+    port: "{{ item }}"
+    permanent: true
+    state: enabled
+  with_items:
+    - "{{ slurm_exporter_port }}/tcp"
+    - "{{ slurm_exporter_port }}/udp"
+  tags: firewalld
+
+- name: Reload firewalld
+  command: firewall-cmd --reload
+  changed_when: true
+  tags: firewalld
+
 - name: Create systemd unit file
   copy:
     src: "{{ role_path }}/files/prometheus-slurm-exporter.service"
@@ -20,6 +36,13 @@
     remote_src: no
     mode: "{{ file_permission }}"
 
+- name: Update the port in service file
+  replace:
+    path: "{{ systemd_path_dest }}/prometheus-slurm-exporter.service"
+    regexp: "0.0.0.0:8080"
+    replace: "0.0.0.0:{{ slurm_exporter_port }}"
+  tags: init
+
 - name: Start services
   systemd:
     name: prometheus-slurm-exporter

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

@@ -35,6 +35,7 @@ prometheus_config_file: "{{ prometheus_inst_path }}/prometheus.yml"
 #Usage: start_service.yml
 file_permission: "0755"
 systemd_path_dest: "/etc/systemd/system/"
+slurm_exporter_port: "8081"
 
 #Usage: configure_prometheus_pod.yml
 slurm_config_file: "slurm_exporter_config.yaml"