Ceri Storey wrote:

> The problem therefore, is that currently, puppet can only say "Make X
> look like Y", not "While doing A make X look like Y and otherwise Z".
> So we could say something like:
> 
> loadbalancer { $ipaddress: ensure => enabled }
> semaphore { $cluster_name: ensure => none }
> 
> with-temporary-state {
>  ensuring => {
>     LoadBalancer[$ipaddress] { ensure => disabled }
>     Semaphore[$cluster_name] { ensure => aquired }
>     }
>  package { wibble: ensure => "1.0.1" }
> }
> 
> So here, puppet would know  that when entering the
> with-temporary-state block it needs to ensure that ensure on the
> loadbalancer resource is set to enabled and the semaphore resource is
> aquired, and that at all other times, they are set to enabled / none
> respectively. Also, if the changing of the state fails, then we'd need
> to skip the block (as puppet does with failed dependencies).

Actually, Puppet can be coaxed into doing something like that already,
and we do it on a couple of our compute clusters.

We run Puppet during the installation of our compute nodes, in the %post
section of kickstart (CentOS).  Since we don't want to start all the
daemons and other things until the node is fully installed and configured,
and has booted properly, we need to make Puppet do different things depending
on whether it is run during kickstart or later.

A not very well-documented feature of facter, is that you can set environment
variables of the form FACTER_FOO, and the fact 'foo' will be created:

     $ FACTER_FOO=gazonk.del facter
     [...]
     foo => gazonk.del

In your manifests you can then check the value of $foo and do different
things.  When we run Puppet from kickstart, we set the environment
variable FACTER_PUP_RUNDAEMONS to "false", and our manifests look like
this:

     # We set $running to stopped when Puppet is run during kickstart, and
     # use $running in every service definition when we would normally have
     # specified 'ensure => running', so services aren't started while the
     # machine is installing.
     $running = $pup_rundaemons ? { "false" => stopped, default => running, }

     class torque-compute-node
     {
         service {
             "pbs_mom":
                 enable => true, ensure => $running, hasstatus => true;
         }
     }

The 'if' and 'case' statements are of course also helpful for this.

You could create some custom fact instead of setting environment variables,
if you want to trigger on something else on the machine.


        /Thomas Bellman

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to