check_prerequisites.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 KIiND, 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. mngmnt_network_container_image_status: false
  18. backup_mngmnt_map_status: false
  19. new_mngmnt_node_status: false
  20. - name: Check if any backup file exists
  21. block:
  22. - name: Check status of backup file
  23. stat:
  24. path: "{{ role_path }}/files/backup_mngmnt_mapping_file.csv"
  25. register: backup_mngmnt_map
  26. - name: Set status for backup file
  27. set_fact:
  28. backup_mngmnt_map_status: true
  29. when: backup_mngmnt_map.stat.exists
  30. rescue:
  31. - name: Message
  32. debug:
  33. msg: "All nodes are new"
  34. verbosity: 2
  35. - name: Inspect the mngmnt_network_container image
  36. command: "buildah images"
  37. register: mngmnt_network_container_image_result
  38. failed_when: false
  39. changed_when: false
  40. - name: Check mngmnt_network_container status on the machine
  41. command: kubectl get pods -n network-config
  42. register: mngmnt_network_container_result
  43. failed_when: false
  44. changed_when: false
  45. - name: Update mngmnt_network_container image status
  46. set_fact:
  47. mngmnt_network_container_image_status: true
  48. when: mngmnt_network_image_name in mngmnt_network_container_image_result.stdout
  49. - name: Update mngmnt_network_container container status
  50. set_fact:
  51. mngmnt_network_container_status: true
  52. when: "'mngmnt-network-container' in mngmnt_network_container_result.stdout"