test_idrac_validation.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. - block:
  16. - name: Include idrac vars
  17. include_vars: "../input_params/idrac_vars.yml"
  18. - name: Export SCP configuration to local file
  19. idrac_server_config_profile:
  20. idrac_ip: "{{ inventory_hostname }}"
  21. idrac_user: "{{ idrac_username }}"
  22. idrac_password: "{{ idrac_password }}"
  23. share_name: "{{ playbook_dir }}"
  24. command: "export"
  25. scp_file: "{{ inventory_hostname }}_scp.xml"
  26. job_wait: true
  27. run_once: true
  28. - name: Fetch the SCP configuration
  29. command: cat "{{ inventory_hostname }}_scp.xml"
  30. register: config_file
  31. - name: Testcase to verify the boot mode
  32. assert:
  33. that:
  34. - config_file.stdout | regex_search( bootmode_regex1 )
  35. fail_msg: " {{ bootmode_check_fail_msg }}"
  36. success_msg: "{{ bootmode_check_success_msg }}"
  37. ignore_errors: true
  38. - name: Testcase to verify the SNMP configuration
  39. assert:
  40. that:
  41. - config_file.stdout | regex_search(snmp_regex1)
  42. fail_msg: " {{ snmp_check_fail_msg }}"
  43. success_msg: "{{ snmp_check_success_msg }}"
  44. ignore_errors: true
  45. - name: Testcase to verify the system profile value Performance
  46. assert:
  47. that:
  48. - config_file.stdout | regex_search(sysprofile_regex1)
  49. fail_msg: " {{ sysprofile_check_fail_msg }}"
  50. success_msg: "{{ sysprofile_check_success_msg }}"
  51. ignore_errors: true
  52. when: idrac_system_profile == sysprofile_value1
  53. - name: Testcase to verify the system profile value PerformancePerWatt(DAPC)
  54. assert:
  55. that:
  56. - config_file.stdout | regex_search(sysprofile_regex2)
  57. fail_msg: " {{ sysprofile_check_fail_msg }}"
  58. success_msg: "{{ sysprofile_check_success_msg }}"
  59. ignore_errors: true
  60. when: idrac_system_profile == sysprofile_value2
  61. - name: Testcase to verify the system profile value WorkstationPerformance
  62. assert:
  63. that:
  64. - config_file.stdout | regex_search(sysprofile_regex3)
  65. fail_msg: " {{ sysprofile_check_fail_msg }}"
  66. success_msg: "{{ sysprofile_check_success_msg }}"
  67. ignore_errors: true
  68. when: idrac_system_profile == sysprofile_value3
  69. - name: Testcase to verify the system profile value PerformancePerWatt(OS)
  70. assert:
  71. that:
  72. - config_file.stdout | regex_search(sysprofile_regex4)
  73. fail_msg: " {{ sysprofile_check_fail_msg }}"
  74. success_msg: "{{ sysprofile_check_success_msg }}"
  75. ignore_errors: true
  76. when: idrac_system_profile == sysprofile_value4
  77. - name: Testcase to verify the pxe device status
  78. assert:
  79. that:
  80. - config_file.stdout | regex_search(pxedevice)
  81. fail_msg: " {{ pxedevice_check_fail_msg }}"
  82. success_msg: "{{ pxedevice_check_success_msg }}"
  83. ignore_errors: true
  84. when: not (enterprise_license or datacenter_license)
  85. - name: Initialized RAID status
  86. set_fact:
  87. raid_type: false
  88. - name: Get iDRAC info details
  89. idrac_system_info:
  90. idrac_ip: "{{ inventory_hostname }}"
  91. idrac_user: "{{ idrac_username }}"
  92. idrac_password: "{{ idrac_password }}"
  93. register: idrac_info
  94. - name: Set RAID status
  95. set_fact:
  96. raid_type: true
  97. with_items: "{{ idrac_info.system_info.Controller }}"
  98. loop_control:
  99. index_var: my_idx3
  100. when: '"RAID" in idrac_info.system_info.ControllerSensor[my_idx3].FQDD'
  101. - name: Testcase to verify virtual disk creation status
  102. assert:
  103. that:
  104. - " 'omnia_vd' in idrac_info.system_info.VirtualDisk[0].Name "
  105. fail_msg: "{{ vd_fail_msg }}"
  106. success_msg: " {{ vd_success_msg }}"
  107. ignore_errors: true
  108. when: raid_type
  109. - name: Execute get pods command
  110. command: "kubectl get pods -n {{ awx_namespace }}"
  111. changed_when: true
  112. register: k8s_pods
  113. ignore_errors: true
  114. run_once: true
  115. - name: Get awx pod
  116. set_fact:
  117. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  118. with_items:
  119. - "{{ k8s_pods.stdout_lines }}"
  120. run_once: true
  121. ignore_errors: true
  122. when: item | regex_search(awx_pod_item_regex)
  123. - name: Get awx cluster ip
  124. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  125. register: awx_cluster_ip
  126. changed_when: false
  127. ignore_errors: true
  128. - name: Get AWX admin password
  129. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  130. register: awx_admin_password
  131. changed_when: false
  132. ignore_errors: true
  133. - name: Execute awx get inventory hosts command
  134. shell: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ provisioned_inventory_name }} -f human --filter 'name'"
  135. changed_when: true
  136. register: idrac_hosts
  137. run_once: true
  138. ignore_errors: true
  139. - name: Testcase to verify IP added to provisioned_idrac_inventory
  140. assert:
  141. that:
  142. - idrac_hosts.stdout | regex_search( inventory_hostname )
  143. fail_msg: "{{ provisioned_ip_fail_msg }}"
  144. success_msg: "{{ provisioned_ip_success_msg }}"
  145. ignore_errors: true
  146. - name: Update firmware
  147. idrac_firmware:
  148. idrac_ip: "{{ inventory_hostname }}"
  149. idrac_user: "{{ idrac_username }}"
  150. idrac_password: "{{ idrac_password }}"
  151. share_name: "/var/nfs_repo/dellupdates"
  152. reboot: false
  153. job_wait: true
  154. apply_update: False
  155. catalog_file_name: "Catalog.xml"
  156. register: idrac_firmware
  157. when: firmware_update_required
  158. - name: Checking firmware update status
  159. assert:
  160. that:
  161. - idrac_firmware.msg in firmware_status
  162. fail_msg: "{{ firmware_fail_msg }}"
  163. success_msg: "{{ firmware_success_msg }}"
  164. ignore_errors: true
  165. when: firmware_update_required
  166. - name: Remove the scp file
  167. file:
  168. path: "{{ inventory_hostname }}_scp.xml"
  169. state: absent
  170. run_once: true
  171. rescue:
  172. - debug:
  173. msg: "{{ failed_msg }}"