main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Verify if slurm-exporter is already installed
  16. command: ls /usr/bin/prometheus-slurm-exporter
  17. register: slurm_exporter_status
  18. changed_when: false
  19. failed_when: false
  20. - name: Install slurm exporter
  21. include_tasks: install_slurm_exporter.yml
  22. when: "'No such file or directory' in slurm_exporter_status.stderr"
  23. - name: Start slurm exporter services
  24. include_tasks: start_services.yml
  25. - name: Verify if kubernetes is already installed
  26. command: ls /usr/bin/kubectl
  27. register: k8s_installation_status
  28. changed_when: false
  29. failed_when: false
  30. - name: Install prometheus on host
  31. include_tasks: install_prometheus.yml
  32. when:
  33. - "'kubernetes' in ansible_skip_tags"
  34. - "'No such file' in k8s_installation_status.stderr"
  35. - name: Install community.grafana collection
  36. command: ansible-galaxy collection install community.grafana
  37. changed_when: True
  38. tags: install
  39. delegate_to: localhost
  40. when: hostvars['127.0.0.1']['control_plane_status']
  41. - name: Configure grafana dashboard
  42. include_tasks: configure_grafana.yml
  43. when:
  44. - grafana_svc_ip != ""
  45. - grafana_svc_port != ""