update_firmware.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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: Update firmware (This task will take time based on current firmware version)
  17. dellemc.openmanage.idrac_firmware:
  18. idrac_ip: "{{ inventory_hostname }}"
  19. idrac_user: "{{ idrac_username }}"
  20. idrac_password: "{{ idrac_password }}"
  21. share_name: "{{ management_station_ip }}:{{ nfs_share_offline_repo }}/dellupdates"
  22. reboot: True
  23. job_wait: True
  24. apply_update: True
  25. catalog_file_name: "Catalog.xml"
  26. register: update_firmware
  27. - name: Wait for one minute to complete firmware update
  28. wait_for:
  29. timeout: 60
  30. run_once: true
  31. - name: Wait for iDRAC port to become active
  32. wait_for:
  33. host: "{{ inventory_hostname }}"
  34. port: "{{ idrac_port }}"
  35. state: started
  36. - name: Firmware update status
  37. debug:
  38. msg: "{{ firmware_job_success_msg }}"
  39. when: not update_firmware.failed
  40. rescue:
  41. - name: Firmware update job status
  42. debug:
  43. msg: "{{ update_firmware.msg }}"
  44. when:
  45. - update_firmware.failed
  46. - idrac_error_message in update_firmware.msg
  47. - name: Firmware update job failed
  48. fail:
  49. msg: "{{ firmware_job_fail_msg }}, Error: {{ update_firmware.msg }}"
  50. when:
  51. - update_firmware.failed
  52. - idrac_error_message not in update_firmware.msg