Problems in plugin default_hostgroup

Problem:
Good afternoon. When using the default_hostgroup plugin, there are some difficulties: not all the selection criteria are sorted out, but the first suitable one. Is it possible to somehow force foreman to check all the facts and only then assign a group for the host? I bring the config


---
:default_hostgroup:
  :facts_map:
    "Ubuntu":
      "operatingsystem": "Ubuntu*"
      "lsbdistcodename": "bionic"
    "CentOS":
      "operatingsystem": "CentOS*"
      "virtual": "vmware"
    "CentOS_Phys":
      "operatingsystem": "CentOS*"

Expected outcome:

Foreman and Proxy versions:
2.4
Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

really no one has encountered???

I think I might be running into a similar issue but want to clarify.

In your example, you would want physical CentOS servers to drop down to the CentOS_Phys hostgroup, but they’re all getting assigned to the first CentOS hostgroup correct?

Just to clarify, based on the code the first match always wins. There’s currently no way to “AND” multiple facts. It’s always “OR”.

That would probably be easy code change if you’re interested in contributing.

Yes, Marek, I think I will find time to change the code. I will publish the results

1 Like