1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- ---
- - name: Include k8s_start_services variables
- include_vars: ../../k8s_start_services/vars/main.yml
- - name: Create prometheus datasource in grafana
- community.grafana.grafana_datasource:
- name: "hpc-prometheus-{{ ansible_default_ipv4.address }}"
- grafana_url: "http://{{ grafana_svc_ip }}:{{ grafana_svc_port }}"
- grafana_user: "{{ hostvars['127.0.0.1']['grafana_username'] }}"
- grafana_password: "{{ hostvars['127.0.0.1']['grafana_password'] }}"
- ds_type: prometheus
- ds_url: "http://{{ ansible_default_ipv4.address }}:{{ nginx_listen_port }}"
- access: direct
- delegate_to: localhost
- no_log: true
- - name: Replace data source in slurm dashboard
- replace:
- path: "{{ role_path }}/files/{{ item }}"
- regexp: '"uid": "hpc.*'
- replace: '"uid": "hpc-prometheus-{{ ansible_default_ipv4.address }}"'
- with_items: "{{ slurm_dashboard_json_files }}"
- delegate_to: localhost
- - name: Replace title in slurm dashboard (1/2)
- replace:
- path: "{{ role_path }}/files/slurm-dashboard-node-exporter.json"
- regexp: '"title": "SLURM - Node Exporter Server Metrics.*'
- replace: '"title": "SLURM - Node Exporter Server Metrics - ({{ ansible_default_ipv4.address }})",'
- delegate_to: localhost
- - name: Replace title in slurm dashboard (2/2)
- replace:
- path: "{{ role_path }}/files/slurm-dashboard.json"
- regexp: '"title": "SLURM - CPUs/GPUs, Nodes, Jobs, Scheduler.*'
- replace: '"title": "SLURM - CPUs/GPUs, Nodes, Jobs, Scheduler ({{ ansible_default_ipv4.address }})",'
- delegate_to: localhost
- - name: Import Slurm Grafana dashboards
- community.grafana.grafana_dashboard:
- grafana_url: "http://{{ grafana_svc_ip }}:{{ grafana_svc_port }}"
- grafana_user: "{{ hostvars['127.0.0.1']['grafana_username'] }}"
- grafana_password: "{{ hostvars['127.0.0.1']['grafana_password'] }}"
- state: present
- commit_message: Updated by ansible
- overwrite: yes
- path: "{{ role_path }}/files/{{ item }}"
- with_items: "{{ slurm_dashboard_json_files }}"
- delegate_to: localhost
- no_log: true
|