On 05/13/2011 04:43 AM, Mark McLoughlin wrote:
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
morazi and I talked a bit about this yesterday afternoon. If I'm reading this correctly, you're suggesting to front-load all images with the complete set of puppet scripts available for all services into each image.
This solves a couple of problems:
1) services defined anywhere in template, assembly, or deployable can still be realized on any particular guest
2) no need to dynamically determine how to deliver configuration engine scripts to the guest at launch time
The only problem it leaves out is how a user might iterate over designing & perfecting their puppet scripts. If puppet scripts are front-loaded into images, then every time puppet scripts change there needs to be a massive rebaking of images. Maybe this is not a bad thing. Maybe this is exactly what would need to happen anyway.
But, it's something that needs to be thought through for the requirements to determine if this sort of functionality if required for the beta.
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.