On Tue, Sep 15, 2009 at 5:39 PM, Bostjan Skufca <bostjan.sku...@gmail.com>wrote:
> > Hi! > > Does anybody know, if resources can be inherited? > > Example: > > I would like to define three files with owner=root and group=bin and > mode=754. > To do that you can write: > file { "file1": > owner=root, > group=bin, > mode=754, > } > file { "file2": > owner=root, > group=bin, > mode=754, > } > file { "file3": > owner=root, > group=bin, > mode=754, > } > > > As you can see there is a bit of redundancy there. > You should do this with setting resource defaults in the current scope instead like: File { ensure => file, owner => root, group => bin, mode => 0754, } file { ["file1", "file2", "file3"]: } http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#resource-defaults > The more elegant way would be something like this (fictive code!): > > file_prototype { > owner=root, > group=bin, > mode=754, > } > file { "file1": include file_prototype, } > file { "file2": include file_prototype, } > file { "file3": include file_prototype, } > > Does something similar to code above exists in puppet? Or any > workaround that does similar trick? > > Thank you, > b. > > > > > -- Nigel Kersten nig...@google.com System Administrator Google Inc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---