Could not load default_hostgroup map from settings [foreman_default_hostgroup]

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

> Path of yaml file:
> ~/foreman/config/settings.plugins.d/default_hostgroup.yaml

~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/

> 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.

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.

··· On 23/10/15 06:58, Eric Ohtake wrote:


Dominic Cleal
dominic@cleal.org

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!

··· On Friday, October 23, 2015 at 4:31:11 PM UTC+9, Dominic Cleal wrote: > > On 23/10/15 06:58, Eric Ohtake wrote: > > Path of yaml file: > > ~/foreman/config/settings.plugins.d/default_hostgroup.yaml > > ~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/ > > > 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.* > > 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 > dom...@cleal.org >

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 dominic@cleal.org

On 23/10/15 11:22, Eric Ohtake wrote:

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!

On Friday, October 23, 2015 at 4:31:11 PM UTC+9, Dominic Cleal wrote:

On 23/10/15 06:58, Eric Ohtake wrote:
> Path of yaml file:
> ~/foreman/config/settings.plugins.d/default_hostgroup.yaml

~foreman, right?  i.e. /usr/share/foreman/config/settings.plugins.d/

> 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 <http://myserver.my.domain.com>",
> "certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|", "apiv"=>"v2",
> :host=>{"name"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|",
> "certname"=>"|myserver.my.domain.com
<http://myserver.my.domain.com>|"}}
> 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
> *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
dom...@cleal.org <javascript:>


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+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

That is great. In the name of the community, thanks for the doc update.

··· On Friday, October 23, 2015 at 7:34:51 PM UTC+9, Dominic Cleal wrote: > > 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 > dom...@cleal.org > > On 23/10/15 11:22, Eric Ohtake wrote: > > 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! > > > > On Friday, October 23, 2015 at 4:31:11 PM UTC+9, Dominic Cleal wrote: > > > > On 23/10/15 06:58, Eric Ohtake wrote: > > > Path of yaml file: > > > ~/foreman/config/settings.plugins.d/default_hostgroup.yaml > > > > ~foreman, right? i.e. /usr/share/foreman/config/settings.plugins.d/ > > > > > 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.* > > > > 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 > > dom...@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-user...@googlegroups.com > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > >