|
@@ -13,6 +13,31 @@
|
|
# limitations under the License.
|
|
# 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
|
|
- 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"
|