List facts for a specific host_group

I am trying to get some information out of foreman and can’t find the right syntax to get it. I have many config groups in foreman and need to get specific facts from a specific config group.

EX: on the facts page I want to query config_group1 and only get the number of processors of each machine in that config group.

I can get it for host groups, but how do I get it for a config group.

Thanks in advance.

Hello and welcome,

Would this be of any use to you:
https://docs.theforeman.org/nightly/Administering_Red_Hat_Satellite/index-foreman.html#sect-Red_Hat_Satellite-Administering_Red_Hat_Satellite-Searching_and_Bookmarking-Building_Search_Queries

Thanks, but I have already looked at that. From “All Hosts” I can use “config_groups = myconfiggroup” and get that list of host that only reside in that group. But I need specific information on the number of processors on those hosts.

So I go over to the “Facts” and I can run “facts.processorcount != 0” and get the number of processors on all the host in the system. I can even run “facts.processorcount != 0 and host.hostgroup = my hostgroup” and get counts on the machines in that hostgroup. But I can’t figure out how to get the number of processors in a particular config_group. Is that not a filterable parameter from the facts page?

I’m afraid, this is not possible.

Looking at the code, it may not be too hard to add support for it foreman/fact_value.rb at 7fa7cec607b26855b329eaa9e6b0613a76743152 · theforeman/foreman · GitHub
foreman/fact_value.rb at 7fa7cec607b26855b329eaa9e6b0613a76743152 · theforeman/foreman · GitHub

OTOH this should probably go to the new Foreman Puppet plugin since config groups has been extraced to it.

Marek,

Thanks for the reply. In the meantime, I am going to change my setup a little to be able to use host_groups vs config_groups to accomplish this and a few other things.