device_config_validations.yml 3.3 KB

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