Host list with Hammer CLI

By: Luke Rawlins May 27, 2020 | 1 minute read
Share this:

Tags: Linux, Satellite 6, hammercli

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.

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.

hammer host list —-help

Related Posts


Force Local Users and Groups with Ansible

I’m in the process of migrating a few Puppet modules over to Ansible, and in the process I’ve run into an unusual situation while creating users and groups. Here is some background. I have an application that will refuse to complete its installation unless it can see certain users and groups in the local passwd and group files. It just so happens that these same users and groups are also contained in LDAP. Read more

Convert a pem file into a rsa private key

When you build a server in AWS one of the last steps is to either acknowledge that you have access to an existing pem file, or to create a new one to use when authenticating to your ec2 server. If you want to convert that file into an rsa key that you can use in an ssh config file, you can use this handy dandy openssl command string. openssl rsa -in somefile. Read more

How to get started using Ansible

Install Ansible On most Linux distributions Ansible can be installed directly through your distribution’s package manager. For those using macOS or a distribution that doesn’t package Ansible, you can install it via python pip. The Ansible docs have a really good walkthrough for installation that can be found here:http://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html I won’t repeat those instructions except to say that you will want to make sure that the computer you install Ansible on should have Python 2. Read more


Contact

If you’d like to get in touch, contact with me via email - or follow on Twitter.

[email protected]