Following the example in the CommonMisconceptions I've done away with
the inherits "base_node" and have instead included the class base_node
and can now successfully pass my $site variable.  However I can't seem
to include the variable in the "source" parameter for "file" type.

For now I'm using this:

file { "/etc/ntp.conf":
        owner   => root,
        group   => root,
        mode    => 0644,
        source => $site ? {
            "sj"    => "puppet:///ntp/SJ/ntp.conf",
            "to"    => "puppet:///ntp/TO/ntp.conf",
            "uk"    => "puppet:///ntp/UK/ntp.conf",
            "pg"    => "puppet:///ntp/PG/ntp.conf",
            default => "puppet:///ntp/ntp.conf",
        },
        notify  => Service[ntpd],
        require => Package["ntp"],
    }

I was just hoping I could use this instead:

source  => "puppet:///ntp/$site/ntp.conf"



On Sep 15, 12:45 pm, Silviu Paragina <sil...@paragina.ro> wrote:
> I thinks you are in the case explained 
> herehttp://reductivelabs.com/trac/puppet/wiki/CommonMisconceptions
>
> Silviu
>
> Mark Christian wrote:
> > say I have a couple nodes:
>
> > node 'uk-host' inherits basenode {
> >     $site = "UK"
> > }
> > node 'ap-host' inherits basenode {
> >     $site = "AP"
> > }
>
> > Is it possible to pass the $site variable to the file resource source
> > parameter?:
>
> > class ntp {
>
> >     package { ntp: ensure => installed }
>
> >     file { "/etc/ntp.conf":
> >         owner   => root,
> >         group   => root,
> >         mode    => 0644,
> >         source  => "puppet:///ntp/$site/ntp.conf",  # $modulepath/ntp/
> > files/{AP,UK}/ntp.conf
> >         source  => "puppet:///ntp/ntp.conf",
> >         notify  => Service[ntpd],
> >         require => Package["ntp"],
> >     }
>
> >     service { ntpd:
> >         name    => "ntpd",
> >         enable  => true,
> >         hasstatus => true,
> >         hasrestart => true,
> >         ensure  => running,
> >         require => Package["ntp"],
> >     }
> > }
>
> > The above does not appear to work.  Am I simply misguided and should I
> > be trying something else?  Thank you.
>
> > Mark
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to