check_prerequisites.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 2021 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. tags: install
  23. - name: Check if any backup file exists
  24. block:
  25. - name: Check status of backup file
  26. stat:
  27. path: "{{ role_path }}/files/backup_mapping_file.csv"
  28. register: infiniband_backup_map
  29. - name: Set status for backup file
  30. set_fact:
  31. infiniband_backup_map_status: true
  32. when: infiniband_backup_map.stat.exists
  33. rescue:
  34. - name: Message
  35. debug:
  36. msg: "All nodes are new"
  37. verbosity: 2
  38. - name: Inspect the infiniband_container image
  39. command: "buildah images"
  40. register: infiniband_container_image_result
  41. failed_when: false
  42. changed_when: false
  43. tags: install
  44. - name: Check infiniband_container status on the machine
  45. command: kubectl get pods -n network-config
  46. register: infiniband_container_result
  47. failed_when: false
  48. changed_when: false
  49. tags: install
  50. - name: Update infiniband_container image status
  51. set_fact:
  52. infiniband_container_image_status: true
  53. when: infiniband_image_name in infiniband_container_image_result.stdout
  54. tags: install
  55. - name: Update infiniband_container container status
  56. set_fact:
  57. infiniband_container_status: true
  58. when: "'infiniband-container' in infiniband_container_result.stdout"
  59. tags: install