check_prerequisites.yml 2.3 KB

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