I am starting to find a pattern in my development and perhaps this might be
useful to others.
When I am doing a fairly complicated package, perhaps with templates for config
files I break them all up.
so I have (using apache for an example)
modules/apache/manifests/
/ init.pp
/ configure.pp
/ install.pp
/ service.pp
/ vhost.pp (apache/nginx
specific I think)
configure.pp likely has...
require => Class["apache::install"],
notify => Class["apache::service"],
install.pp likely will...
notify => Class["apache::service"],
service.pp likely will...
require => Class["apache::install"],
vhost.pp likely will...
require => Class["apache::install"],
notify => Class["apache::service"],
This has the following effects...
packages are installed first
service is restarted when configuration changes occur
I've been putting dependent packages into modules/prerequisite/manifests and I
have to 'include' them if I want to use them with notify/require - for example,
apache w/ passenger installation requires some other packages...
class prerequisite::apache {
$prerequisites = [ "apache2-prefork-dev", "libapr1-dev", "libaprutil1-dev" ]
package { $prerequisites : ensure => "installed" }
}
thus I have to include prerequisite::apache' somewhere to require it in the
install.pp
to keep things cleaner, I have abstracted an apache_server class which includes
this and other packages our apache servers will need and on a particular node,
I only have to include the apache_server class.
class apache_server {
include gems::passenger
include prerequisite::apache
include prerequisite::compiler
include prerequisite::compression
include prerequisite::ssl
}
Thus my node might be a bit simpler...
apache::configure { 'test.ttinet':
port => 8080,
ip => "*",
ssl => false,
}
apache::vhost { "test2.ttinet":
port => 8080,
docroot => "/var/www/test2.ttinet",
ssl => false,
priority => 10,
serveraliases => ['test4', 'test3'],
}
(obviously I have templates for apache2.conf, ports.conf, ssl.conf and any
amount of vhosts
--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com
Need help communicating between generations at work to achieve your desired
success? Let us help!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.