--- - name: "Ansible Module for Simple Firmware Rollback" hosts: redfish_hosts gather_facts: false tasks: - name: Rollback firmware components for 17G block: - name: Get all firmware inventory ansible.builtin.uri: url: "{{ 'https://' + baseuri + '/redfish/v1/UpdateService/' + 'FirmwareInventory?$expand=*($levels=1)' }}" method: GET ca_path: "/path/to/ca_cert.pem" url_username: "{{ username }}" url_password: "{{ password }}" headers: Content-Type: "application/json" return_content: true register: redfish_response - name: Extract all 'Name' attributes from the response ansible.builtin.set_fact: firmware_names: "{{ redfish_response.json.Members | map(attribute='Name') | list }}" - name: Find the firmware name that contains 'BIOS' ansible.builtin.set_fact: bios_firmware_name: "{{ firmware_names | select('contains', 'BIOS') | first }}" - name: Rollback the BIOS component firmware dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "{{ bios_firmware_name }}" delegate_to: localhost tags: rollback-bios-17g - name: Find the firmware name that contains 'NIC' ansible.builtin.set_fact: network_firmware_name: "{{ firmware_names | select('contains', 'NIC') | first }}" - name: Rollback all NIC cards with a name starting from 'NIC' for 17G. dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "{{ network_firmware_name }}" delegate_to: localhost tags: rollback-match-17g - name: Rollback all the component firmware except BIOS component for 17G. dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "(?!{{ bios_firmware_name }}).*" delegate_to: localhost tags: rollback-except-17g - name: Rollback a BIOS component firmware for 16G dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "BIOS" delegate_to: localhost tags: rollback-bios - name: Rollback all NIC cards with a name starting from ' Broadcom Gigabit' for 16G. dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "Broadcom Gigabit Ethernet.*" delegate_to: localhost tags: rollback-match - name: Rollback all the component firmware except BIOS component for 16G. dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: "(?!BIOS).*" delegate_to: localhost tags: rollback-except - name: Rollback all the available firmware component for 16G and 17G. dellemc.openmanage.redfish_firmware_rollback: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" name: ".*" delegate_to: localhost tags: rollback-all