update_firmware.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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: 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. state: started
  43. - name: Firmware update status
  44. debug:
  45. msg: "{{ firmware_job_success_msg }}"
  46. when:
  47. - model_status
  48. - not update_firmware.failed
  49. - name: Firmware update skip status
  50. debug:
  51. msg: "{{ firmware_job_skip_msg }}"
  52. when: not model_status
  53. rescue:
  54. - name: Firmware update job status
  55. debug:
  56. msg: "{{ update_firmware.msg }}"
  57. when:
  58. - update_firmware.failed
  59. - idrac_error_message in update_firmware.msg
  60. - name: Firmware update job failed
  61. fail:
  62. msg: "{{ firmware_job_fail_msg }}, Error: {{ update_firmware.msg }}"
  63. when:
  64. - update_firmware.failed
  65. - idrac_error_message not in update_firmware.msg