Thanks Dan. I thought Puppet may have a way to automagically search for a
file based on environment first (e.g. modules/nfs/$environment/foo), then a
default as specified by source (e.g. modules/nfs/foo). I can see how what
you pasted helps, but it could become tedious having to specify the search
path in various places.

On Wed, Oct 12, 2011 at 12:14 PM, Dan White <[email protected]> wrote:

> 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 
> <[email protected]>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
>> <[email protected]> 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 <[email protected]>
>> 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 <[email protected]>
>> >>> To: [email protected]
>> >>> 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
>> >>> <[email protected]> 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 [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.
>>
>>
>
> --
> 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.
>
>
>  --
> 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.
>

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

Reply via email to