Hey,
Just to clarify some subtleties in what I sent yesterday
Below is a complete service definition in a file called my_postfix.pp - i.e. everything to describe the service is in here
It is just a puppet manifest that follows conventions required of service definitions
Puppet manifests for all services are included by the image builder in the images themselves in a standard location
On Thu, 2011-05-12 at 18:11 +0100, Mark McLoughlin wrote:
class postfix($enabled = false, $relayhost = '') {
All service definitions have an enabled parameter which defaults to false
Perhaps instead, we could have:
import "aeolus"
class postfix($relahost = '') inherits aeolus::template { }
Services add their own parameters, each of which must have a sensible default
Service definitions should also have documentation, using the standard puppet documentation format:
# Class: postfix # # Enable the postfix SMTP server # # Parameters: # $relayhost: # the next-hop destination of non-local mail; see # http://www.postfix.org/postconf.5.html#relayhost # # ... class postfix($relahost = '') inherits aeolus::template { }
package { 'postfix': ensure => installed }
This is asserted whether the service is enabled or not
The image builder "realizes" (i.e. runs) the service's puppet manifest with the default parameters, which means that the postfix package is installed by the image builder
if $enabled { augeas { 'postfix_conf': context => '/files/etc/postfix/main.cf', changes => "set relayhost ${relayhost}", notify => Service['postfix'], require => Package['postfix'] }
exec { '/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix': require => Package['postfix'] } service { ['sendmail', 'exim']: enable => false, ensure => stopped } service { 'postfix': enable => true, ensure => running, require => [ Service[sendmail, exim], Augeas[postfix_conf] ] }
The rest of the config is realized at instance startup time (via audrey_startup) only if the service is enabled
Cheers, Mark.