Host list with Hammer CLI
On occasion I need to pull a host list from Satellite 6; and while using the web ui is often simple enough, the hammer cli that comes with foreman is often faster.
Here is a quick way to get a full host list:
hammer host list
That command will print list of all hosts registered with your Satellite server.
Filter by OS major version
Often when I’m generating this list it’s because someone has asked me something like: “How many RHEL 5, servers do we have?”
You can generate a list of all the Red Hat Enterprise Linux 5 machines you have registered to Satellite like this:
hammer host list —-search os_major=5
Of course if you wanted to see RHEL 6 or 7 or 8 you would just replace the “5”, with the major version of the OS you were looking for.
Checkout other options with the help option
hammer host list —-help