rsom@certifydatasystems.com
2012-Dec-18 17:09 UTC
[Puppet Users] site.pp referring to other manifests without modules
Hi all, I want to do some code reuse, and modules seem overkill. Is it possible to have something like this? A file called myuser.pp class myuser { user {...} file {...} ... } Then in site.pp have this: node ''foo.example.com'' { include myuser .. other things .. } node ''bar.example.com'' { include myuser .. other things .. } When I try this, I get a class not found: myuser (HTTP/400) error. Is there a simpler way to do this? R, rahul -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XLD-NK_1wH0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ellison Marks
2012-Dec-18 17:41 UTC
[Puppet Users] Re: site.pp referring to other manifests without modules
You want ''import''. Do note that it is fairly discouraged. http://docs.puppetlabs.com/puppet/3/reference/lang_import.html On Tuesday, December 18, 2012 9:09:33 AM UTC-8, rs...@certifydatasystems.com wrote:> > Hi all, > > I want to do some code reuse, and modules seem overkill. Is it possible to > have something like this? > > A file called myuser.pp > class myuser { > user {...} > file {...} > ... > } > > Then in site.pp have this: > node ''foo.example.com'' { > include myuser > .. other things .. > } > > node ''bar.example.com'' { > include myuser > .. other things .. > } > > When I try this, I get a class not found: myuser (HTTP/400) error. Is > there a simpler way to do this? > > R, > rahul >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SVsXaQyHOxkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
rsom@certifydatasystems.com
2012-Dec-18 18:15 UTC
[Puppet Users] Re: site.pp referring to other manifests without modules
Thanks! On Tuesday, December 18, 2012 9:41:54 AM UTC-8, Ellison Marks wrote:> > You want ''import''. Do note that it is fairly discouraged. > http://docs.puppetlabs.com/puppet/3/reference/lang_import.html > > > On Tuesday, December 18, 2012 9:09:33 AM UTC-8, > rs...@certifydatasystems.com wrote: >> >> Hi all, >> >> I want to do some code reuse, and modules seem overkill. Is it possible >> to have something like this? >> >> A file called myuser.pp >> class myuser { >> user {...} >> file {...} >> ... >> } >> >> Then in site.pp have this: >> node ''foo.example.com'' { >> include myuser >> .. other things .. >> } >> >> node ''bar.example.com'' { >> include myuser >> .. other things .. >> } >> >> When I try this, I get a class not found: myuser (HTTP/400) error. Is >> there a simpler way to do this? >> >> R, >> rahul >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/0QjkgDxyl9oJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Calvin Walton
2012-Dec-21 21:09 UTC
Re: [Puppet Users] site.pp referring to other manifests without modules
On Tue, 2012-12-18 at 09:09 -0800, rsom@certifydatasystems.com wrote:> Hi all, > > I want to do some code reuse, and modules seem overkill. Is it possible to > have something like this?Modules really aren''t that much overkill, and will help clean things up a bit. I''d really recommend using them over the ''import'' suggestion.> A file called myuser.pp > class myuser { > user {...} > file {...} > ... > }Just move this file to /etc/puppet/modules/myuser/init.pp> Then in site.pp have this: > node ''foo.example.com'' { > include myuser > .. other things .. > } > > node ''bar.example.com'' { > include myuser > .. other things .. > }Then these ''include''s will automatically find the file modules/myuser/init.pp and load it for you. That''s it! -- Calvin Walton <calvin.walton@kepstin.ca> -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Calvin Walton
2012-Dec-21 21:17 UTC
Re: [Puppet Users] site.pp referring to other manifests without modules
On Fri, 2012-12-21 at 16:09 -0500, Calvin Walton wrote:> On Tue, 2012-12-18 at 09:09 -0800, rsom@certifydatasystems.com wrote: > > Hi all, > > > > I want to do some code reuse, and modules seem overkill. Is it possible to > > have something like this? > > Modules really aren''t that much overkill, and will help clean things up > a bit. I''d really recommend using them over the ''import'' suggestion. > > > A file called myuser.pp > > class myuser { > > user {...} > > file {...} > > ... > > } > > Just move this file to /etc/puppet/modules/myuser/init.ppI''m sorry, I made a typo here... the correct path is /etc/puppet/modules/myuser/manifests/init.pp I know it''s a fairly long path, but it''s still just one file. Using modules even for simple stuff is a good idea, in my opinion.> > Then in site.pp have this: > > node ''foo.example.com'' { > > include myuser > > .. other things .. > > } > > > > node ''bar.example.com'' { > > include myuser > > .. other things .. > > } > > Then these ''include''s will automatically find the file > modules/myuser/init.pp and load it for you. That''s it!-- Calvin Walton <calvin.walton@kepstin.ca> -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.