Problem:
Using the default hostgroup plugin to put nodes in hostgroups based on a custom fact. However, the fact value is never matched by the plugin and the default ‘catch all’ option is always used.
Expected outcome:
The plugin would match the custom fact and apply the corresponding hostgroup/environment to that node
Foreman and Proxy versions:
foreman-1.20.2-1.el7.noarch
foreman-proxy-1.20.2-1.el7.noarch
Foreman and Proxy plugin versions:
tfm-rubygem-foreman_default_hostgroup-5.0.0-3.fm1_20.el7.noarch
Other relevant data:
I’ve set the “force_hostgroup_match_only_new” to no and “force_hostgroup_match” to yes in the UI and restarted foreman and httpd.
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
2019-04-16T14:41:14 [I|app|3cfc7] Processing by Api::V2::HostsController#facts as JSON
2019-04-16T14:41:14 [I|app|3cfc7] Parameters: {"facts"=>"[FILTERED]", "name"=>"ticemp1-ll1.jhuapl.edu", "certname"=>"ticemp1-ll1.jhuapl.edu", "apiv"=>"v2", "host"=>{"certname"=>"ticemp1-ll1.jhuapl.edu", "name"=>"ticemp1-ll1.jhuapl.edu"}}
2019-04-16T14:41:15 [I|app|3cfc7] Import facts for 'ticemp1-ll1.jhuapl.edu' completed. Added: 0, Updated: 21, Deleted 0 facts
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = dare
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = MyAPLCloud-dmz
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = MyAPLCloud
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = Opt-in
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = dev
2019-04-16T14:41:15 [I|app|3cfc7] Fact = apl_env
2019-04-16T14:41:15 [I|app|3cfc7] Regex = test
2019-04-16T14:41:16 [I|app|3cfc7] Fact = hostname
2019-04-16T14:41:16 [I|app|3cfc7] Regex = .*
2019-04-16T14:41:16 [I|app|3cfc7] DefaultHostgroupMatch: ticemp1-ll1.jhuapl.edu added to default
2019-04-16T14:41:16 [I|app|3cfc7] Completed 201 Created in 1887ms (Views: 3.4ms | ActiveRecord: 546.7ms)
When I do a ‘facter apl_env’ on the node:
[root@ticemp1-ll1 ~]# facter apl_env
test
Yet this host (and other hosts I’ve tried always catch the ‘default’ option, here’s the config:
---
:default_hostgroup:
:facts_map:
"DARE":
"apl_env": "dare"
"default/MyAPLCloud-dmz":
"apl_env": "MyAPLCloud-dmz"
"default/MyAPLCloud":
"apl_env": "MyAPLCloud"
"default/Opt-in":
"apl_env": "Opt-in"
"default-dev":
"apl_env": "dev"
"default-test":
"apl_env": "test"
"default":
"hostname": ".*"
If you need more information let me know. Thanks.