How to list errata for multiple hosts using Hammer CLI on Red Hat Satellite 6?

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.x

Issue

  • How to list errata for multiple hosts?
  • Query a Host Collection to list errata for the hosts.

Resolution

  • The below script will list errata for hosts that are a part of a particular Host Collection by querying it as follows,
    # hammer host-collection list                        || Note the ID 
    # for i in `hammer host-collection hosts --id <Host-Collection ID>| sed -e '1,3d'|sed -e '$d'|cut -d' ' -f 1`; do echo "Errata details for: " `hammer host info --id $i|sed '2!d'`;hammer host errata list --host-id $i;done

Note: Replace <Host-Collection ID> with the noted ID.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.