How to display hosts without my custom fact?

Problem:
Hello dear community!

For my purposes, I created a fact containing the name of the package, and the value of its version.
(for example “host_package_list::mc = 4.8.19-9.el8.x86_64”)
How can I show all hosts that DO NOT have fact named “host_package_list::mc”, i.e. package “mc” is not installed on machine.
I am tried to input “not has fact = host_package_list::mc”, but it’s useless.

Thanks!
Expected outcome:

Foreman and Proxy versions:
Foreman 2.1.4
Puppet 6.14
Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

I’m afraid this is currently not possible, the RFE is tracked as Feature #1611: Search for hosts without certain facts - Foreman. It could probably be implemented as a custom scoped search function.

1 Like

I found a workaround crutch solution. I created a fact that contains an array of all installed packages ( all_pkgs = [‘mc’,‘htop’,‘7zip’…‘zzz’] ). This allows you to make queries like “facts.all_pkgs !~ ‘mc’” - will find all computers without the mc package installed