Plugin. foreman_default_hostgroup. Order of precedence?

Howdy everyone.

Using the foreman_default_hostgroup with some success, but wondering what the rules are that govern which host is added to what group?

Referring to this example:

*:default_hostgroup:*
* :facts_map:*
* "Primary Site - Development":*
* "domain": ".*development.internal"*
* "Primary Site - Development/Foreman":*
* "fdqn": "host((0[1-9])|(10)).development.internal"*

Any host with a DNS suffix of *.development.internal* will be added to the *Development *host group.

The second directive is intended to add any fqdn of
*host01.development.internal*-*host10.development.internal* to the nested *Development/Foreman* host group.

However, all hosts (with the correct domain) are *only *being applied to *Development*.

If I comment out *Development *host group and the accompanying *domain *fact, the hosts are correctly assigning to *Development/Foreman* so i know the regex is correct.

Any suggestions as to what I may be doing wrong?
Okay. Might have is sussed.

Tested swapping the order of the directives (after coming across https://groups.google.com/forum/#!topic/foreman-users/5Q0ZI71GLfg) and may the host is assigned on first match?

*:default_hostgroup:*
* :facts_map:*
* "Primary Site - Development/Foreman":*
* "fdqn": "host((0[1-9])|(10)).development.internal"*
* "Primary Site - Development":*
* "domain": ".*development.internal"*

Don't have a larger sample or additional criteria at this time, but our aim to place the most specific rule first, moving forward.


··· On Tuesday, December 5, 2017 at 9:42:19 AM UTC+8, BJ wrote:

Howdy everyone.

Using the foreman_default_hostgroup with some success, but wondering what
the rules are that govern which host is added to what group?

Referring to this example:

*:default_hostgroup:*
* :facts_map:*
* "Primary Site - Development":*
* "domain": ".*development.internal"*
* "Primary Site - Development/Foreman":*
* "fdqn": "host((0[1-9])|(10)).development.internal"*

Any host with a DNS suffix of *.development.internal* will be added to
the *Development *host group.

The second directive is intended to add any fqdn of
*host01.development.internal*-*host10.development.internal* to the nested
*Development/Foreman* host group.

However, all hosts (with the correct domain) are *only *being applied to
*Development*.

If I comment out *Development *host group and the accompanying *domain *fact,
the hosts are correctly assigning to *Development/Foreman* so i know the
regex is correct.

Any suggestions as to what I may be doing wrong?

Correct, first match wins, so yes, place your most specific rules first. Documentation patches are very much welcome ;)

Greg


··· On 05/12/17 05:13, BJ wrote:
Okay. Might have is sussed.

Tested swapping the order of the directives (after coming across
https://groups.google.com/forum/#!topic/foreman-users/5Q0ZI71GLfg) and
may the host is assigned on first match?
Appreciate the confirmation, Greg.

Once I figure out the process for extending the documentation, I'd be happy to oblige.


··· On Wednesday, December 6, 2017 at 7:16:51 AM UTC+8, Greg Sutcliffe wrote:

On 05/12/17 05:13, BJ wrote:
Okay. Might have is sussed.

Tested swapping the order of the directives (after coming across
https://groups.google.com/forum/#!topic/foreman-users/5Q0ZI71GLfg) and
may the host is assigned on first match?

Correct, first match wins, so yes, place your most specific rules first.
Documentation patches are very much welcome ;)

Greg