if I try the above workaround using title it fails, this shouldnt
host update --name host-dev.demo.domain --new-organization-title dev --new-location-title dev --hostgroup-title dev/hostgroup1
Expected outcome:
To be able to set the name via title
Foreman and Proxy versions:
2.1.0 Foreman and Proxy plugin versions:
2.1.0 Distribution and version:
puppet 6.17 / CentOS Linux release 7.8.2003 (Core)
Other relevant data:
Is it possible to have the puppet registration run default to an organization/location instead of being blank. for example what ever the default has been set to, which in my case would have been “dev”
I have read cases like this before, however could not see a solution other than the above hammer based workaround, which is not really ideal as it requires access to the foreman server.
How do I get default organization / location to be enabled and working, so the hammer workaround and access to the foreman cli is not needed.
Setting this in the WebInterface is also something I would rather not need to do. Defaulting to something that is not blank is what should happen
please provide url if this is duplicate. As I am using the latest version of foreman with puppet6
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.
CLI
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
Cant help noticing the Case issues above!
[default_organization] yet gui calls it [default_organisation]
Organi{z|s}ation or organi{z|s}ation
Location or location
Is this the issue, things are not getting set due the leading upper case element name.
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.
Well many thanks! seems having double quotes on the installer line was causing it an issue and post install the value is populated in webconsole without quotes