http://docs.puppetlabs.com/references/stable/type.html#file

under "source"
If you specify multiple file sources for a file, then the first source that 
exists will be used. This allows you to specify what amount to search paths for 
files:

  file { "/path/to/my/file":
    source => [
      "/modules/nfs/files/file.$host",
      "/modules/nfs/files/file.$operatingsystem",
      "/modules/nfs/files/file"
    ]
  }
This will use the first found file as the source.


On Oct 11, 2011, at 5:43 PM, Gonzalo Servat wrote:

> Somewhat related to this, is there a way for Puppet to source files in this 
> manner:
> 
> First: /etc/puppet/modules/<module>/$environment/<file>
> Default: /etc/puppet/modules/<module>/<file>
> 
> Just to avoid having the same directory structure under 
> /etc/puppet/$environment/ as Deven has done.
> 
> Best regards,
> Gonzalo
> 
> On Wed, Oct 12, 2011 at 8:26 AM, Deven Phillips <deven.phill...@gmail.com> 
> wrote:
> Jacob,
> 
>    That was the problem!! Thanks so much for the help. And Aaron and
> everyone else as well. Much appreciated!!
> 
> Deven
> 
> On Tue, Oct 11, 2011 at 3:56 PM, Deven Phillips
> <deven.phill...@gmail.com> wrote:
> > Trying that out now.. I will respond back in a bit with results.
> >
> > Thanks!!!
> >
> > Deven
> >
> > On Tue, Oct 11, 2011 at 3:42 PM, Jacob Helwig <ja...@puppetlabs.com> wrote:
> >> The layout should look something more like this:
> >>  
> >> /etc/puppet/prod/modules/$module_name/files/generic_node/etc/ssh/sshd_config
> >>
> >> With the source lines looking like:
> >>  puppet://lou1/modules/$module_name/generic_node/etc/ssh/sshd_config
> >>
> >>
> >> If you wanted 'generic_node' to be the name of the module, then you'd
> >> have the layout as
> >>
> >>  /etc/puppet/prod/modules/generic_node/files/etc/ssh/sshd_config
> >>
> >> and the source line as
> >>
> >>  puppet://lou1/modules/generic_node/etc/ssh/sshd_config
> >>
> >> --
> >> Jacob Helwig
> >>
> >> On Tue, 11 Oct 2011 15:26:16 -0400, Deven Phillips wrote:
> >>> Date: Tue, 11 Oct 2011 15:26:16 -0400
> >>> From: Deven Phillips <deven.phill...@gmail.com>
> >>> To: puppet-users@googlegroups.com
> >>> Subject: Re: [Puppet Users] Issues switching over to using environments
> >>> Message-ID: 
> >>> <cajw+4nd2kwpgc5-mre1k23of_ym9equbaa+09xmukzkou-o...@mail.gmail.com>
> >>>
> >>> The manifest which calls this looks like:
> >>>
> >>>         file {"/etc/ssh/sshd_config":
> >>>                 owner   => "root",
> >>>                 group   => "root",
> >>>                 mode    => "0644",
> >>>                 ensure  => "present",
> >>>                 source  =>
> >>> "puppet://lou1/modules/files/generic_node/etc/ssh/sshd_config",
> >>>                 require => Package['openssh'],
> >>>                 notify  => Service['ssh'],
> >>>         }
> >>>
> >>> And the current error on the agent node shows:
> >>>
> >>> err: /Stage[main]/Secureshell/File[/etc/ssh/sshd_config]: Could not
> >>> evaluate: Could not retrieve information from environment production
> >>> source(s) puppet://lou1/modules/files/generic_node/etc/ssh/sshd_config
> >>> at /etc/puppet/prod/manifests/classes/ssh.pp:55
> >>>
> >>>
> >>> TIA,
> >>>
> >>> Deven
> >>>
> >>> On Tue, Oct 11, 2011 at 3:23 PM, Deven Phillips
> >>> <deven.phill...@gmail.com> wrote:
> >>> > Nope, that didn't seem to help the way I tried it... So, here's my 
> >>> > layout:
> >>> >
> >>> > /etc/puppet/
> >>> >                  prod/
> >>> >                         modules/
> >>> >                                      files/
> >>> >                                             generic_node/
> >>> >                                                                 etc/
> >>> >                                                                       
> >>> > ssh/
> >>> >
> >>> >       sshd_config
> >>> >
> >>> > From a machine which is using "production" as it's environment, and
> >>> > production points to "prod/modules" for it's modules; I still get
> >>> > errors trying to get the sshd_config file.
> >>> >
> >>> > TIA!!
> >>> >
> >>> > Deven
> >>> >
> >>
> >
> 
> --
> 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.
> 
> 
> 
> -- 
> 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.

-- 
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