There are settings for default location and default organization that should apply in these cases and set the default. If they don’t than that’s a bug
Additionally, there are settings for Organization fact and Location fact that allow you to define a custom fact name which will set the organization and location if present in the host facts.
I have the default location and default organization set to dev via hammer on the install of foreman2
So the puppet run is ignoring this and they are getting blank.
please explain how I can use
“Additionally, there are settings for Organization fact and Location fact that allow you to define a custom fact name which will set the organization and location if present in the host facts.”
All of these settings are accessible from the Settings -> Puppet in the UI or from hammer settings list iirc in hammer.
Please confirm that the values for the defaults are correctly set to the location/organization title - it has to be a full match or it won’t be properly chosen.
For the custom fact, you need to provide a custom fact to puppet with the name defined in the setting and the value of the location/organization title you want to assign the host to.
Just did a new build to confirm we are looking at bug here. The webconsole is showing the value as blank, yet hammer is saying it is set.
here is the diagnostics on this.
hammer> settings set --name default_organization --value dev
Setting [default_organization] updated to [dev].
hammer> settings set --name default_location --value dev
Setting [default_location] updated to [dev].
[root@NODENAME vagrant]# hammer -u admin -p PASSWORD settings list
default_location | Default location | dev | Hosts created after a puppet run that did not send a location fact will be pl…
default_organization | Default organization | dev | Hosts created after a puppet run that did not send a organization fact will b…
default_puppet_environment | Default Puppet environment | dev | Foreman will default to this puppet environment if it cannot auto detect one
HAMMER showing correct values, however in the webconsole the values are blank
The value displayed in the UI for the setting name is a human-readable string that gets translated, so in your case I’m assuming you have the en_GB locale set where “organization” is translated to “organisation”. In any case the setting name in the db is default_organization, which you can see if you hover on the name in the ui.
Do you have both a location and an organization both named dev? note that this value is case sensitive and refers to the title and not name of the organization/location (e.g. if you have UK/Dev location, you need to set the setting to UK/Dev and not dev). Can you share the output of hammer locations list just to make sure?
In the webconsole, the drop down box does offer “dev” as an option, so it is possible to set it( although I would rather have hammer and gui matching" ) not sure why it is adding diouble quotes to the name
Once it is set in the webconsole, a default puppet registration goes into the correct location/organization.
So fix why hammer is not updating it and its fixed.
Looks like the name you gave to the location and organization includes the quotes as part of the name - it started from the installer where you added the quotes to the name.
You can rename them to not include the quotes or add the quotes to your hammer command as well.