Discussion:
[foreman-users] Could not load default_hostgroup map from settings [foreman_default_hostgroup]
Eric Ohtake
2015-10-23 05:58:16 UTC
Permalink
Guys,

I have a new installation of Foreman (v.1.9.2) in a new Ubuntu 14.04.03 and
everything is working great.

I have installed the plugin from Greg (foreman_default_hostgroup) to have
some automation on the grouping field and followed the instructions from
the Foreman's plugins page.
But my nodes are not being grouped at all.

I wrote a default_hostgroup.yaml with the config as follows:
---
:default_hostgroup:
:facts_map:
"Workstations/Location1":
"network_local_area_connection": "182.35.18.0"
"Workstations/Location2":
"network_local_area_connection": "182.35.20.0"
"Default":
"hostname": ".*"


I kept it simple so I could focus on making it to work but no luck.

This is what I have done so far:

Tried to use a even simpler fact like:
---
:default_hostgroup:
:facts_map:
"Linux":
"osfamily": "Debian"
"lsbdistcodename": "trusty"

Path of yaml file:
~/foreman/config/settings.plugins.d/default_hostgroup.yaml
Changed the settings force_hostgroup_match to true and
force_hostgroup_match_only_new to false.

Content of /var/log/foreman/production.log:
2015-10-23T14:30:42 [app] [I] Started POST "/api/hosts/facts" for
192.168.10.10 at 2015-10-23 14:30:42 +0900
2015-10-23T14:30:42 [app] [I] Processing by Api::V2::HostsController#facts
as JSON
2015-10-23T14:30:42 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"myserver.my.domain.com", "certname"=>"myserver.my.domain.com",
"apiv"=>"v2", :host=>{"name"=>"myserver.my.domain.com", "certname"=>"
myserver.my.domain.com"}}
2015-10-23T14:30:43 [app] [I] Import facts for 'myserver.my.domain.com'
completed. Added: 0, Updated: 5, Deleted 0 facts
*2015-10-23T14:30:43 [app] [W] DefaultHostgroupMatch: Could not load
default_hostgroup map from settings, check config.*
2015-10-23T14:30:43 [app] [I] Completed 201 Created in 408.4ms (Views:
8.0ms | ActiveRecord: 0.0ms)
2015-10-23T14:30:43 [app] [I] Started GET "/node/myserver.my.domain.com?format=yml"
for 192.168.10.10 at 2015-10-23 14:30:43 +0900
2015-10-23T14:30:43 [app] [I] Processing by HostsController#externalNodes
as YML
2015-10-23T14:30:43 [app] [I] Parameters: {"name"=>"myserver.my.domain.com
"}
2015-10-23T14:30:43 [app] [I] Rendered text template (0.0ms)
2015-10-23T14:30:43 [app] [I] Completed 200 OK in 124.5ms (Views: 0.8ms |
ActiveRecord: 12.0ms)


Would you guys have any ideas?

Thx
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Dominic Cleal
2015-10-23 07:31:07 UTC
Permalink
Post by Eric Ohtake
~/foreman/config/settings.plugins.d/default_hostgroup.yaml
~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/
Post by Eric Ohtake
|
2015-10-23T14:30:42 [app] [I] Started POST "/api/hosts/facts" for
192.168.10.10 at 2015-10-23 14:30:42 +0900
2015-10-23T14:30:42 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2015-10-23T14:30:42 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"myserver.my.domain.com",
"certname"=>"|myserver.my.domain.com|", "apiv"=>"v2",
:host=>{"name"=>"|myserver.my.domain.com|",
"certname"=>"|myserver.my.domain.com|"}}
2015-10-23T14:30:43 [app] [I] Import facts for
'|myserver.my.domain.com|' completed. Added: 0, Updated: 5, Deleted 0 facts
*2015-10-23T14:30:43 [app] [W] DefaultHostgroupMatch: Could not load
default_hostgroup map from settings, check config.*
This error suggests it's not picking up the settings at all.

Have you restarted Foreman since adding/changing the file? Note that by
default Foreman's running under Apache, so "service apache2 restart" or
"touch ~foreman/tmp/restart.txt" to do it - don't restart the "foreman"
service.
--
Dominic Cleal
***@cleal.org
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Eric Ohtake
2015-10-23 10:22:24 UTC
Permalink
Dominic,

As always, you nailed it!

I misread the manual and where I read
~foreman/config/settings.plugins.d/default_hostgroup.yaml I tought I would
have to create these folders into the root user folder.
That's why I came with ~*/*
foreman/config/settings.plugins.d/default_hostgroup.yaml

The correct path to put the yaml file, as you said, is:
/usr/share/foreman/config/settings.plugins.d/

Now I have everything working fine!

Also thank you about the restart tip.

You are a life saver.

Thanks!
Post by Dominic Cleal
Post by Eric Ohtake
~/foreman/config/settings.plugins.d/default_hostgroup.yaml
~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/
Post by Eric Ohtake
|
2015-10-23T14:30:42 [app] [I] Started POST "/api/hosts/facts" for
192.168.10.10 at 2015-10-23 14:30:42 +0900
2015-10-23T14:30:42 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2015-10-23T14:30:42 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"myserver.my.domain.com",
"certname"=>"|myserver.my.domain.com|", "apiv"=>"v2",
:host=>{"name"=>"|myserver.my.domain.com|",
"certname"=>"|myserver.my.domain.com|"}}
2015-10-23T14:30:43 [app] [I] Import facts for
'|myserver.my.domain.com|' completed. Added: 0, Updated: 5, Deleted 0
facts
Post by Eric Ohtake
*2015-10-23T14:30:43 [app] [W] DefaultHostgroupMatch: Could not load
default_hostgroup map from settings, check config.*
This error suggests it's not picking up the settings at all.
Have you restarted Foreman since adding/changing the file? Note that by
default Foreman's running under Apache, so "service apache2 restart" or
"touch ~foreman/tmp/restart.txt" to do it - don't restart the "foreman"
service.
--
Dominic Cleal
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Dominic Cleal
2015-10-23 10:34:46 UTC
Permalink
Ah okay, no problem.

That documentation was probably written before we had the easier path of
/etc/foreman/plugins/ (/usr is now a symlink to it), so I've updated it,
which should be clearer.
--
Dominic Cleal
Post by Eric Ohtake
Dominic,
As always, you nailed it!
I misread the manual and where I read
~foreman/config/settings.plugins.d/default_hostgroup.yaml I tought I
would have to create these folders into the root user folder.
That's why I came with
~*/*foreman/config/settings.plugins.d/default_hostgroup.yaml
/usr/share/foreman/config/settings.plugins.d/
Now I have everything working fine!
Also thank you about the restart tip.
You are a life saver.
Thanks!
Post by Eric Ohtake
~/foreman/config/settings.plugins.d/default_hostgroup.yaml
~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/
Post by Eric Ohtake
|
2015-10-23T14:30:42 [app] [I] Started POST "/api/hosts/facts" for
192.168.10.10 at 2015-10-23 14:30:42 +0900
2015-10-23T14:30:42 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2015-10-23T14:30:42 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"myserver.my.domain.com <http://myserver.my.domain.com>",
"certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|", "apiv"=>"v2",
Post by Eric Ohtake
:host=>{"name"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|",
Post by Eric Ohtake
"certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|"}}
Post by Eric Ohtake
2015-10-23T14:30:43 [app] [I] Import facts for
'|myserver.my.domain.com <http://myserver.my.domain.com>|'
completed. Added: 0, Updated: 5, Deleted 0 facts
Post by Eric Ohtake
*2015-10-23T14:30:43 [app] [W] DefaultHostgroupMatch: Could not load
default_hostgroup map from settings, check config.*
This error suggests it's not picking up the settings at all.
Have you restarted Foreman since adding/changing the file? Note that by
default Foreman's running under Apache, so "service apache2 restart" or
"touch ~foreman/tmp/restart.txt" to do it - don't restart the "foreman"
service.
--
Dominic Cleal
--
You received this message because you are subscribed to the Google
Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Eric Ohtake
2015-10-23 11:55:57 UTC
Permalink
That is great. In the name of the community, thanks for the doc update.
Post by Dominic Cleal
Ah okay, no problem.
That documentation was probably written before we had the easier path of
/etc/foreman/plugins/ (/usr is now a symlink to it), so I've updated it,
which should be clearer.
--
Dominic Cleal
Post by Eric Ohtake
Dominic,
As always, you nailed it!
I misread the manual and where I read
~foreman/config/settings.plugins.d/default_hostgroup.yaml I tought I
would have to create these folders into the root user folder.
That's why I came with
~*/*foreman/config/settings.plugins.d/default_hostgroup.yaml
/usr/share/foreman/config/settings.plugins.d/
Now I have everything working fine!
Also thank you about the restart tip.
You are a life saver.
Thanks!
Post by Eric Ohtake
~/foreman/config/settings.plugins.d/default_hostgroup.yaml
~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/
Post by Eric Ohtake
|
2015-10-23T14:30:42 [app] [I] Started POST "/api/hosts/facts" for
192.168.10.10 at 2015-10-23 14:30:42 +0900
2015-10-23T14:30:42 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
{"facts"=>"[FILTERED]",
Post by Eric Ohtake
Post by Eric Ohtake
"name"=>"myserver.my.domain.com <http://myserver.my.domain.com>",
"certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|", "apiv"=>"v2",
Post by Eric Ohtake
:host=>{"name"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|",
Post by Eric Ohtake
"certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|"}}
Post by Eric Ohtake
2015-10-23T14:30:43 [app] [I] Import facts for
'|myserver.my.domain.com <http://myserver.my.domain.com>|'
completed. Added: 0, Updated: 5, Deleted 0 facts
Post by Eric Ohtake
*2015-10-23T14:30:43 [app] [W] DefaultHostgroupMatch: Could not
load
Post by Eric Ohtake
Post by Eric Ohtake
default_hostgroup map from settings, check config.*
This error suggests it's not picking up the settings at all.
Have you restarted Foreman since adding/changing the file? Note that by
default Foreman's running under Apache, so "service apache2 restart"
or
Post by Eric Ohtake
"touch ~foreman/tmp/restart.txt" to do it - don't restart the
"foreman"
Post by Eric Ohtake
service.
--
Dominic Cleal
--
You received this message because you are subscribed to the Google
Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send
<javascript:>
Post by Eric Ohtake
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+***@googlegroups.com.
To post to this group, send email to foreman-***@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
Loading...