check_prerequisites.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: Initialize variables
  16. set_fact:
  17. infiniband_container_status: false
  18. infiniband_container_image_status: false
  19. - name: Inspect the infiniband_container image
  20. command: "buildah images"
  21. register: infiniband_container_image_result
  22. failed_when: false
  23. changed_when: false
  24. - name: Create directories if they don't exist
  25. block:
  26. - name: Checking directory
  27. stat:
  28. path: "{{ item }}"
  29. register: stat_result
  30. with_items:
  31. - "{{ subnet_manager.cache_directory }}"
  32. - "{{ subnet_manager.log_directory }}"
  33. loop_control:
  34. label: "{{ item }}"
  35. - name: Creating directories
  36. file:
  37. path: "{{ item.item }}"
  38. state: directory
  39. mode: "{{ folder_perm }}"
  40. group: root
  41. owner: root
  42. when: not item.stat.exists
  43. loop: "{{ stat_result.results }}"
  44. loop_control:
  45. label: "{{ item.item }}"
  46. - name: Copy opensm configuration file
  47. copy:
  48. src: "{{ opensm_conf_file }}"
  49. dest: "{{ opensm_conf_file_dest }}"
  50. mode: preserve
  51. force: yes
  52. - name: Check infiniband_container status on the machine
  53. command: kubectl get pods -n network-config
  54. register: infiniband_container_result
  55. failed_when: false
  56. changed_when: false
  57. - name: Update infiniband_container image status
  58. set_fact:
  59. infiniband_container_image_status: true
  60. when: infiniband_image_name in infiniband_container_image_result.stdout
  61. - name: Update infiniband_container container status
  62. set_fact:
  63. infiniband_container_status: true
  64. when: "'infiniband-container' in infiniband_container_result.stdout"