For some reason I cannot see the obvious answers staring back at me, so i am going to toss it out here..
quick back story-
In my org, we only own the "get the platform configured" part of system configuration and not anything to do with the actual install of the application on the system. With that, we have different requirements based on the application type that will be running on the system. This includes the application role account, its uid/gid, proc limits ect in order to prepare the platform so they can deploy their application..
I have a functioning module to do this, where we (using foreman) set the role_user variable to something like tomcat, pentaho etc... However in adding in some functionality, I am trying to make the clean up the module / rewrite it a bit...
My issue is what is the best way to do this..
Is there a way to use the params.pp file based on a parameters value to give different defaults (where role_user is defined in the init.pp and possibly overridden by foreman)?
ie
class app_type::params {
$source_base = "puppet:///modules/${module_name}/"
case $role_user {
'appadm' : {
$role_user_group = 'appadm'
$role_user_uid_default = '1302'
$role_user_gid_default = '1302'
$role_user_home_default = '/home/appadm'
$role_user_comment_default = 'Application Administrator Role'
$role_user_shell_default = '/bin/bash'
$file_limits_default = '4096'
$proc_limits_default = 'undef'
}
'tomcat' : {
$role_user_uid_default = '1301'
$role_user_gid_default = '1301'
I am pretty sure the answer is no, that the params.pp things need to be derived from facts that are already known...
But what I can't seem to come up with in my head, is what is the best way to achieve a similar result? Does anyone have any thoughts that can kick me into the right direction?
Or am I overthinking this and it is best just to stick with a separate class for each item that I am trying to have as an option in my "case" statement?
thx!
↧