Hi!
We run a number of different types of Apache webserver (1.3 with
mod_perl, 2.0/worker, 2.0/prefork/PHP, stock RedHat, etc.) which I''d
like to manage with Puppet. I''ve been developing an Apache module with
a top-level class which represents the bare bones of all Apache
installs:
class apache {
package { "httpd": ensure => installed }
service { "httpd":
ensure => running,
enable => true,
require => Package["httpd"]
}
file {
"/etc/httpd/conf/httpd.conf":
ensure => present,
source => "puppet://$servername/apache/httpd.conf",
notify => Service["httpd"],
require => Package["httpd"];
"/etc/httpd/conf.d":
ensure => present,
recurse => true,
source => "puppet://$servername/apache/conf.d",
notify => Service["httpd"],
require => Package["httpd"];
}
define module {
$package = "mod_$name"
$config = "$name.conf"
package { $package:
ensure => installed,
require => Package["httpd"],
before => $before
}
}
This is class is inherited by other, more specific classes:
class apache::static_farm inherits apache {
Package["httpd"] {
ensure => "2.0.63-1.nol"
}
apache::module { [ "ipinfo", "zeus"]:
before => Service["httpd"]
}
line { "set_httpd_worker": # ''line'' from DavidS
line => "HTTPD=/usr/sbin/httpd.worker",
file => "/etc/sysconfig/httpd";
}
file {
"/etc/httpd/conf/maps":
ensure => present,
recurse => true,
source => "puppet://$servername/apache/maps/",
notify => Exec["httpd_rebuild_maps"],
require => Package["httpd"];
}
}
I''m aiming to get to the point where I can "include apache"
for a
bog-standard, install-the-rpm-and-run-the-service Apache box or
"include apache::specific" to deploy a particular type of Apache
server. One of the issues with this setup is that I''d like to be able
to deploy different resources (say, httpd.conf) depending on the
Apache class without needing to painstakingly specify a different
resource in each class. I don''t want:
class apache {
file { "/etc/httpd/conf/httpd.conf":
source => "puppet://$servername/apache/httpd.conf-stock"
}
}
class apache::static_farm inherits apache {
file { "/etc/httpd/conf/httpd.conf":
source => "puppet://$servername/apache/httpd.conf-static_farm"
}
}
Is there a variable that contains the most-specific class name? That
is, could I do something like:
class apache {
file { "/etc/httpd/conf/httpd.conf":
source => [
"puppet://$servername/apache/httpd.conf-$classname",
"puppet://$servername/apache/httpd.conf-stock"
]
}
}
to get a class-specific file if one exists, or a standard one if not?
I don''t want to define a $role variable or similar in the node
definitions; to have to specify $apache_role = "static_farm" as well
as "include apache::static_farm" seems redundant and a potential
source of problems later on.
Lastly, any other suggestions on my approach? Comments or criticisms
are welcome.
Thanks!
Mark Drayton
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---