device_config_validations.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. mngmnt_network_container_status: false
  18. tags: init
  19. - name: Check mngmnt_network_container status on the machine
  20. command: kubectl get pods -n network-config
  21. register: mngmnt_network_container_result
  22. failed_when: false
  23. changed_when: false
  24. tags: init
  25. - name: Validate if mngmnt_network is present if device_config is false
  26. set_fact:
  27. mngmnt_network_container_status: true
  28. when: "'mngmnt-network-container' in mngmnt_network_container_result.stdout"
  29. tags: init
  30. - name: Validate if mngmnt_network is present if device_config is false
  31. assert:
  32. that: device_config_support != false
  33. success_msg: "{{ mgmnt_device_fail }}"
  34. fail_msg: "{{ mgmnt_device_fail }}"
  35. when: mngmnt_network_container_status
  36. tags: validate
  37. - name: Assert value of idrac_support if mngmnt_network container needed
  38. assert:
  39. that: idrac_support == true
  40. success_msg: "{{ idrac_support_valid }}"
  41. fail_msg: " {{ failed_idrac_support }}"
  42. when: device_config_support
  43. tags: validate
  44. - block:
  45. - name: Assert ethernet_switch_support
  46. assert:
  47. that: ethernet_switch_support == true or ethernet_switch_support == false
  48. success_msg: "{{ ethernet_switch_support_success_msg }}"
  49. fail_msg: "{{ ethernet_switch_support_fail_msg }}"
  50. tags: validate
  51. - name: Assert ib_switch_support
  52. assert:
  53. that: ib_switch_support == true or ib_switch_support == false
  54. success_msg: "{{ ib_switch_support_success_msg }}"
  55. fail_msg: "{{ ib_switch_support_fail_msg }}"
  56. tags: validate
  57. - name: Assert powervault_support
  58. assert:
  59. that: powervault_support == true or powervault_support == false
  60. success_msg: "{{ powervault_support_success_msg }}"
  61. fail_msg: "{{ powervault_support_fail_msg }}"
  62. tags: validate
  63. when: device_support_status
  64. - block:
  65. - name: Check value of ethernet_switch_support when not device_config_support
  66. assert:
  67. that: ethernet_switch_support == true
  68. success_msg: "{{ ethernet_device_config }}"
  69. failed_when: false
  70. tags: validate
  71. - name: Set ethernet_switch_support when not device_config_support
  72. set_fact:
  73. ethernet_switch_support: false
  74. tags: init
  75. - name: Check value of ib_switch_support when not device_config_support
  76. assert:
  77. that: ib_switch_support == true
  78. success_msg: "{{ ib_device_config }}"
  79. failed_when: false
  80. tags: validate
  81. - name: Set ib_switch_support when not device_config_support
  82. set_fact:
  83. ib_switch_support: false
  84. tags: init
  85. - name: Check value of powervault_support when not device_config_support
  86. assert:
  87. that: powervault_support == true
  88. success_msg: "{{ pv_device_config }}"
  89. failed_when: false
  90. tags: validate
  91. - name: Set powervault_support when not device_config_support
  92. set_fact:
  93. powervault_support: false
  94. tags: init
  95. when: not device_support_status