start_services.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright 2020 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: Firewall port addition for slurm exporter
  16. firewalld:
  17. zone: public
  18. port: "{{ item }}"
  19. permanent: true
  20. state: enabled
  21. with_items:
  22. - "{{ slurm_exporter_port }}/tcp"
  23. - "{{ slurm_exporter_port }}/udp"
  24. tags: firewalld
  25. - name: Reload firewalld
  26. command: firewall-cmd --reload
  27. changed_when: true
  28. tags: firewalld
  29. - name: Create systemd unit file
  30. copy:
  31. src: "{{ role_path }}/files/prometheus-slurm-exporter.service"
  32. dest: "{{ systemd_path_dest }}"
  33. remote_src: no
  34. mode: "{{ file_permission }}"
  35. - name: Update the port in service file
  36. replace:
  37. path: "{{ systemd_path_dest }}/prometheus-slurm-exporter.service"
  38. regexp: "0.0.0.0:8080"
  39. replace: "0.0.0.0:{{ slurm_exporter_port }}"
  40. tags: init
  41. - name: Start services
  42. systemd:
  43. name: prometheus-slurm-exporter
  44. state: restarted
  45. enabled: yes