Feature #9355
closedHostgroup parameters - Environment aware
Description
Currently, a hostgroup parameter can take only 1 value, not taking the environmnent we are running on.
It would be nice to add this dependency and have something like:
hostgroup A - hostgroup parameter X
If environment == production; then X="prodValue"
elsif environment == acceptance; then X="AccValue"
…
At least we really need this feature as we created an autofs Module using hostgroup parameters to know which shares must be mounted for a specific hostgroup.
Current workaround we currently have is the following:
variable_name: autofs_hostgroup_base
variable_value:
Dev: mountA
Tst: mountA,mountB
Acc: mountB,mountC
Prd: mountA,mountB,mountC
Which makes thing a bit ugly and not very generic.
Regards;
Updated by Dominic Cleal almost 10 years ago
- Status changed from New to Feedback
Smart class parameters or smart variables should provide this functionality. Add environment to the order list and you can then add matchers on host group, environment etc in a particular order.
http://theforeman.org/manuals/1.7/index.html#4.2.6SmartMatchers and surrounding sections has more information.
#5204 and others also cover moving the "smart" functionality to host group/global parameters themselves, while at the moment it's just on class parameters.
Updated by Florent Delvaille almost 10 years ago
Well, yeah Smart Variables and Smartclass parameters will be a perfect solution but …
If you add a parameter to a hostgroup, we cannot specify matcher on it … it does not appear in SmartVariable and of course not in SmartClass parameters …
So we dont see how to do it …
Hope this clarify a bit ?
Updated by Dominic Cleal almost 10 years ago
Adding a parameter to a group is different. Start the other way around - add the parameter to your Puppet class, import Puppet classes and then the new parameter should show up under Smart Class Parameters. You can then add matchers on that tab for "hostgroup=Foo" or "environment=Production" - anything that is listed in the "Order" list on the smart class parameter.
Updated by Florent Delvaille almost 10 years ago
This is what we basically did as a test, but this is a huge work for nothing tbh.
Each hostgroup can have its own parameter, value can be different from env to env … it is really looking as a very complex process specially if you have a lot of hostgroups and environments …
While by just having a hostgroup parameter totally outside a puppet module, just as a parameter, and value changing with environment selection, it sounds way more logical to me tbh.
The expected behavior is in fact the same as the puppet classes you see depending on the environment you select.
Thx for your feedback