update_firmware.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. - block:
  16. - name: Set model status
  17. set_fact:
  18. model_status: true
  19. when: item in idrac_info.system_info.System[0].Model
  20. with_items: "{{ poweredge_model.split(',') | map('trim') }}"
  21. - name: Update firmware (This task will take time based on current firmware version)
  22. dellemc.openmanage.idrac_firmware:
  23. idrac_ip: "{{ inventory_hostname }}"
  24. idrac_user: "{{ idrac_username }}"
  25. idrac_password: "{{ idrac_password }}"
  26. share_name: "{{ management_station_ip }}:{{ nfs_share_offline_repo }}/dellupdates"
  27. reboot: True
  28. job_wait: True
  29. apply_update: True
  30. catalog_file_name: "Catalog.xml"
  31. register: update_firmware
  32. when: model_status
  33. - name: Wait for one minute to complete firmware update
  34. wait_for:
  35. timeout: 60
  36. run_once: true
  37. when: model_status
  38. - name: Wait for iDRAC port to become active
  39. wait_for:
  40. host: "{{ inventory_hostname }}"
  41. port: "{{ idrac_port }}"
  42. delay: "{{ max_delay }}"
  43. timeout: "{{ max_timeout }}"
  44. state: started
  45. - name: Firmware update status
  46. debug:
  47. msg: "{{ firmware_job_success_msg }}"
  48. when:
  49. - model_status
  50. - not update_firmware.failed
  51. - name: Firmware update skip status
  52. debug:
  53. msg: "{{ firmware_job_skip_msg }}"
  54. when: not model_status
  55. rescue:
  56. - name: Firmware update job status
  57. debug:
  58. msg: "{{ update_firmware.msg }}"
  59. when:
  60. - update_firmware.failed
  61. - idrac_error_message in update_firmware.msg
  62. - name: Firmware update job failed
  63. debug:
  64. msg: "{{ firmware_job_fail_msg }}, Error: {{ update_firmware.msg }}"
  65. when:
  66. - update_firmware.failed
  67. - idrac_error_message not in update_firmware.msg