Joshua Anderson wrote:
> Case statements don't work inside of resource definitions. There are
> three ways I can think of do what you're doing:
>
> 1. Use multiple inline selectors. (Very long and ugly.)
> 2. Write four different definitions of the NTP service and wrap them
> in a case statement (Not as long, but still ugly.)
> 3. Use if statements to set some variables, then use those in a single
> NTP service definition. (Shorter, maybe less ugly.)
>
> Here's an example of number 3:
>
[snip]
>
> This isn't great, but if you have multiple services that differ in a
> similar fashion, you can define all the variables you need in a few
> statements at the top of your class and have one short definition for
> each service.
Ahhhh
A lot of things in puppet now make more sense, thanks heaps!
>
> -Josh
>
> On Mar 9, 2009, at 4:59 PM, Steve Wray wrote:
>
>> I want to stop ntpd on all domU and openvz virtual machines while
>> enabling
>> it on all dom0 and physical machines.
>>
>> I've been trying to get my head around this and searched through
>> documentation and examples but cannot find anything like this so far.
>>
>> If its running Debian Sarge then the init script is /etc/init.d/ntp-
>> server
>>
>> If its running Etch or Lenny then its /etc/init.d/ntp
>>
>> I'd thought that the "name" variable of 'service' was supposed to
>> indicate
>> this? Or have I got my conditionals way wrong? Because the code I've
>> included doesn't seem to do anything at all. Not even a syntax
>> error...
>>
>>
>> class services {
>>
>> service { "ntp_service":
>>
>> name => $lsbdistcodename ? {
>> 'sarge' => "ntp-server",
>> 'etch' => "ntp",
>> 'lenny' => "ntp",
>> },
>>
>> case $virtual {
>> 'xenu','openvz':
>> {
>> ensure => stopped,
>> enable => false,
>> pattern => "ntpd"
>> }
>> 'xen0','physical':
>> {
>> ensure => running,
>> enable => true,
>> pattern => "ntpd"
>> }
>> }
>> }
>> }
>>
>> --
>> Please remember that an email is just like a postcard; it is not
>> confidential nor private nor secure and can be read by many other
>> people
>> than the intended recipient. A postcard can be read by anyone at the
>> mail
>> sorting office and expecting what is written on it to be private and
>> secret
>> is not realistic. Please hold no higher expectation of email.
>>
>> If you need to send confidential information in an email you need to
>> use
>> encryption. PGP is Pretty good for this.
>>
>
>
> >
--
Please remember that an email is just like a postcard; it is not
confidential nor private nor secure and can be read by many other people
than the intended recipient. A postcard can be read by anyone at the mail
sorting office and expecting what is written on it to be private and secret
is not realistic. Please hold no higher expectation of email.
If you need to send confidential information in an email you need to use
encryption. PGP is Pretty good for this.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---