Hammer get hosts

hi all,

its possible in hammer to get hosts where the hostgroups are empty ?
grafik

hammer host list --search --hostgorup-id=*
empty
Null
“”
‘’

all of them doesnt work…

Thanks in advance

Regards
Neeloj

Try:

hammer host list --search "! has hostgroup"
4 Likes

thank you so much @jtruestedt it works :slight_smile:

@jtruestedt where did you find that ? any documentations?

Have you seen these docs yet?
https://docs.theforeman.org/3.0/Managing_Hosts/index-foreman-el.html

2 Likes

I used the auto-completion in the GUI and then transferred it to hammer

3 Likes

No @mcorr thank you, I’ll read it

1 Like

@jtruestedt I dont get you but thank you :slight_smile:

image

and with some googling for reference i found this: Foreman :: Advance Search tips in Foreman

3 Likes

So he is using the syntax found here:

https://docs.theforeman.org/3.0/Administering_Red_Hat_Satellite/index-foreman-el.html#sect-Administering-Searching_and_Bookmarking-Building_Search_Queries

and then he is using it to build hammer commands !

2 Likes

Thanks for the link - I always tried operators but this is a good documentation :slight_smile:

1 Like

thank you @jtruestedt and @mcorr , I tested and I can do many things with it :slight_smile:

1 Like