Overriding files specified in modules

224 views
Skip to first unread message

Keith Edmunds

unread,
Feb 5, 2009, 6:58:05 AM2/5/09
to puppet...@googlegroups.com
Can I override files specified in a module on a per-client basis?

Suppose I have a module that is to be installed on a large number of
clients, and one of the files it provides is /x/y/z. One a very small
number of clients, that file needs to be slightly modified. What I want to
do in the module, ideally, is something like:

file { "/x/y/z":
if (file puppet:///mymodule/$fqdn/z exists:
source => puppet:///mymodule/$fqdn/z
else:
source => puppet:///mymodule/z

Is there a way to achieve that?

Thanks,
Keith

Peter Meier

unread,
Feb 5, 2009, 7:40:35 AM2/5/09
to puppet...@googlegroups.com
Hi

from: http://reductivelabs.com/trac/puppet/wiki/TypeReference#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 => [
"/nfs/files/file.$host",
"/nfs/files/file.$operatingsystem",
"/nfs/files/file"
]
}


this seems to be your solution.

cheets pete

ps: I couldn't live without that nice feature!

Nicolas Szalay

unread,
Feb 6, 2009, 4:49:29 AM2/6/09
to puppet...@googlegroups.com
Le jeudi 05 février 2009 à 13:40 +0100, Peter Meier a écrit :

> from: http://reductivelabs.com/trac/puppet/wiki/TypeReference#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 => [
> "/nfs/files/file.$host",
> "/nfs/files/file.$operatingsystem",
> "/nfs/files/file"
> ]
> }
>
>
> this seems to be your solution.
>
> cheets pete
>
> ps: I couldn't live without that nice feature!

YEAH ! This is the post of the week ! I was turning my head up & down to
find a way to put user & host specific authorized keys.

--
Nicolas Szalay

Administrateur systèmes & réseaux

-- _
ASCII ribbon campaign ( )
- against HTML email X
& vCards / \

signature.asc
Reply all
Reply to author
Forward
0 new messages