deploy_slurm_telemetry.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: Get all images
  16. command: "buildah images"
  17. register: images_result
  18. failed_when: false
  19. changed_when: false
  20. - name: Update the permission of init_k8s_pod.sh
  21. file:
  22. path: "{{ role_path }}/files/init_k8s_pod.sh"
  23. mode: "{{ slurm_telemetry_code_dir_mode }}"
  24. when: slurm_telemetry_image not in images_result.stdout
  25. - name: Create slurm_telemetry image
  26. command: buildah bud -t {{ slurm_telemetry_image }}:{{ slurm_telemetry_image_tag }} -f {{ role_path }}/files/Dockerfile
  27. args:
  28. chdir: "{{ role_path }}/files/"
  29. changed_when: true
  30. when: slurm_telemetry_image not in images_result.stdout
  31. - name: Deploy slurm_telemetry pod
  32. command: kubectl apply -f {{ role_path }}/files/k8s_slurm_telemetry.yml
  33. changed_when: true
  34. - name: Wait for slurm_telemetry pod to come to ready state
  35. command: kubectl wait --for=condition=ready -n {{ namespace }} pod -l app=slurm-telemetry --timeout=4m
  36. changed_when: true
  37. - name: Delete input config file
  38. file:
  39. path: "{{ role_path }}/files/monster/config.yml"
  40. state: absent
  41. - name: Delete init k8s pod file
  42. file:
  43. path: "{{ role_path }}/files/init_k8s_pod.sh"
  44. state: absent