Hi Guys,
I'm using an ENC to define all my nodes including some modules I want to load, I have the following class/define for this:
class mymodule::modules::enable (
$enable_modules = undef
) {
$modules_split = split($enable_modules, ',')
enableModules { $modules_split: }
}
define enableModules () {
exec { "mycommand $name" :
command => "/usr/sbin/mycommand $name",
notify => Service[myservice]
}
}
mymodule::modules::enable{'modX': enable_modules => 'module'}
Now I'm using this per node using mod1,mod2,mod3 which works OK, I don't want to use create_resources here as I want to have one filed for enable, and one field for disable in my ENC
For some fool-proof solution that when the module is not set in my ENC I want to require the define enableModules in a different class and set a static parameter:
some::class ( )
{
Class['modulename'] -> MyModule::Modules::Enable['modX:']
file { "/my/path/to/directory" :
ensure => directory,
mode => '0644',
owner => 'root',
group => 'root',
require => Class['modulename'],
}
}
Well, I need to wrap a class around my define to get this all working as you can see above but this is not working as my some::class says:
Could not find dependency Class[Enable_mymodule] for File[/my/path/to/directory] at...
I have tried includes, different ways of defining or wrapping the class but no clue at all, I also get other errors that are not related as I was messing things more up.
When I use:
Class['modulename] -> class { 'mymodule::modules::enable': enable_modules => 'mymodule' }
I get the message that it cannot redeclare 'mymodule::modules::enable' as my ENC already did.
I have used some Foo parameters and Vars here as I want to use this in more modules if this is possible. It's just for a fallback when modules are needed for sofware to be loaded and the user didn't enable it in it's ENC yaml.
I hope someone can help me out.
Thanks,
Matt