I want to start out with an apache class that will disable all modules
except for a pre-defined list, thus establishing a baseline of active
modules.
Then as needed, other classes could enable a module that they require
that would have been disabled by the baseline state.
Its possible several classes may try to enable the same module (1 or
more classes needing module1 could be on a single node)

What is the 'right' way to do this?  I've played with virtual
resources and class inheritance.
I hope to avoid class inheritance if possible as virtual resources
seems to be the correct way to do this kind of thing.
I however have had troubles with doing that and have ultimately ended
up with the following using inheritance:


class apache2::modules {

   # list apache modules to enable
   $enable_apachemods  = [ "module1", "module2", "module3", ]

   # list apache modules to disable, basically all modules would be
listed here by default
   $disable_apachemods = [ "module4", "module5", "module6", ]

   # Process list of apache modules to enable
   a2mod { $enable_apachemods: ensure => "present", notify =>
Exec["apache2reload"] }

   # Process list of apache modules to disable
   a2mod { $disable_apachemods: ensure => "absent", notify =>
Exec["apache2reload"] }

}




Then as I have other classes defined that require a specific apache
module they should simply set it to 'present'.


class application1 {
    include apache2::modules::app1
...

}

class apache2::modules::app1 inherits apache2::modules {
     A2mod['module4'] { ensure => 'present', require =>
Package['modulepackage'] }
}




class application2 {
    include apache2::modules::app2
...

}

class apache2::modules::app2 inherits apache2::modules {
     A2mod['module4'] { ensure => 'present', require =>
Package['modulepackage'] }
}



I get the following error when I do it this way:

   Error 400 on SERVER: Parameter 'ensure' is already set on
A2mod[module4]... cannot redefine at....

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to