david.eauee@gmail.com
2013-Mar-18 12:01 UTC
[Puppet Users] setting up default param value to all instances of a specific resource type
hi, Specifically I would like to have something like top scope resource defaults so as to enforce,... well,... default behaviors across our modules for example, with the exec type: Exec { logoutput => on_failure } However our puppet code base is rather extensive and the responsibility for it is "distributed", so I was wondering if there was a way to set those up in one place and affect all class and type instances across our deployments. The only way I can think I can think of would be to declare it at the top level of the site.pp but I would rather have in a module (we have base modules which get installed on every nodes) is there any other option? thanks you, david. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
joe
2013-Mar-18 16:59 UTC
[Puppet Users] Re: setting up default param value to all instances of a specific resource type
There''s no way to have the defaults in the top scope if you put them in a module. Module implies class, which implies a scope under top scope. Site.pp would be the appropriate place, but keep in mind there is no way to "enforce" these defaults. There''s a fairly common practice these days of setting resource defaults in a class when you have multiple resources with the same parameters. I believe setting any defaults at a lower scope will cause puppet to ignore the ones set at the higher scope (not to merge them), so it''s likely there''s not a good solution to what you''re trying to do short of a commit hook that denies any defaults outside site.pp. On Monday, March 18, 2013 6:01:10 AM UTC-6, david...@gmail.com wrote:> > hi, > > Specifically I would like to have something like top scope resource > defaults so as to enforce,... well,... default behaviors across our modules > > for example, with the exec type: Exec { logoutput => on_failure } > > However our puppet code base is rather extensive and the responsibility > for it is "distributed", so I was wondering if there was a way to set those > up in one place and affect all class and type instances across our > deployments. > > The only way I can think I can think of would be to declare it at the top > level of the site.pp but I would rather have in a module (we have base > modules which get installed on every nodes) > > is there any other option? > > thanks you, > david. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Mar-19 15:34 UTC
[Puppet Users] Re: setting up default param value to all instances of a specific resource type
On Monday, March 18, 2013 7:01:10 AM UTC-5, david...@gmail.com wrote:> > hi, > > Specifically I would like to have something like top scope resource > defaults so as to enforce,... well,... default behaviors across our modules > > for example, with the exec type: Exec { logoutput => on_failure } > > However our puppet code base is rather extensive and the responsibility > for it is "distributed", so I was wondering if there was a way to set those > up in one place and affect all class and type instances across our > deployments. > > The only way I can think I can think of would be to declare it at the top > level of the site.pp but I would rather have in a module (we have base > modules which get installed on every nodes) > > is there any other option? > >If you need a declaration to apply globally, then it must, perforce, appear at top scope. Moreover, it is safest and clearest for it to appear before other declarations, such as node blocks. Although it is possible and valid to make top-scope declarations in any manifest, putting them outside the direct purview of site.pp produces issues revolving around when and even whether those declarations are parsed. So don''t do that. What you can do, however, is put such declarations in a separate file, and ''import'' that file into site.pp. That''s a common practice for node blocks, but they are just common a special case of top-scope declarations. The ''import'' function doesn''t have many good uses any more, but this is exactly the sort of thing it''s good and appropriate for. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.