I am trying to understand Puppet''s Ruby DSL. I have tried it in server-less mode using ''puppet apply'' and it worked fine. But I am not sure how to organize it in the server. It is a simple manifest file without any modules and classes in it. Should it go in the regular manifests directory (which already contains few manifests in Puppet DSL)? - thanks, neuby.r -- 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.
This might help you: http://docs.puppetlabs.com/learning/ Lots of people seem to have a structure so that /etc/puppet/manifests/site.pp does this: import "nodes/*" And then your node definitions are in separate files in /etc/puppet/manifests/nodes. Of course, each to their own. Maybe you like a different system. On Tue, Nov 01, 2011 at 09:46:56AM -0500, neubyr wrote:> I am trying to understand Puppet''s Ruby DSL. I have tried it in > server-less mode using ''puppet apply'' and it worked fine. But I am not > sure how to organize it in the server. It is a simple manifest file > without any modules and classes in it. Should it go in the regular > manifests directory (which already contains few manifests in Puppet > DSL)? > > - thanks, > neuby.r > > -- > 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. > >-- 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.
On Tue, Nov 1, 2011 at 9:53 AM, Christopher Wood <christopher_wood@pobox.com> wrote:> This might help you: > > http://docs.puppetlabs.com/learning/ > > Lots of people seem to have a structure so that /etc/puppet/manifests/site.pp does this: > > import "nodes/*" > > And then your node definitions are in separate files in /etc/puppet/manifests/nodes. Of course, each to their own. Maybe you like a different system.Thanks Chris, that''s helpful. I am wondering if I should be mixing Ruby DSL manifests with the Puppet DSL manifests. Is there any recommended practice for keeping both styles together? Also, does Ruby DSL get converted into Puppet DSL before execution?> > On Tue, Nov 01, 2011 at 09:46:56AM -0500, neubyr wrote: >> I am trying to understand Puppet''s Ruby DSL. I have tried it in >> server-less mode using ''puppet apply'' and it worked fine. But I am not >> sure how to organize it in the server. It is a simple manifest file >> without any modules and classes in it. Should it go in the regular >> manifests directory (which already contains few manifests in Puppet >> DSL)? >> >> - thanks, >> neuby.r-- 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.
On Tue, Nov 01, 2011 at 04:17:41PM -0500, neubyr wrote:> On Tue, Nov 1, 2011 at 9:53 AM, Christopher Wood > <christopher_wood@pobox.com> wrote: > > This might help you: > > > > http://docs.puppetlabs.com/learning/ > > > > Lots of people seem to have a structure so that /etc/puppet/manifests/site.pp does this: > > > > import "nodes/*" > > > > And then your node definitions are in separate files in /etc/puppet/manifests/nodes. Of course, each to their own. Maybe you like a different system. > > > Thanks Chris, that''s helpful. I am wondering if I should be mixing > Ruby DSL manifests with the Puppet DSL manifests. Is there any > recommended practice for keeping both styles together? Also, does Ruby > DSL get converted into Puppet DSL before execution?I couldn''t tell you since I''ve only used Puppet DSL. I thought everything was rendered into ruby before execution. I could be wrong.> > On Tue, Nov 01, 2011 at 09:46:56AM -0500, neubyr wrote: > >> I am trying to understand Puppet''s Ruby DSL. I have tried it in > >> server-less mode using ''puppet apply'' and it worked fine. But I am not > >> sure how to organize it in the server. It is a simple manifest file > >> without any modules and classes in it. Should it go in the regular > >> manifests directory (which already contains few manifests in Puppet > >> DSL)? > >> > >> - thanks, > >> neuby.r > > -- > 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. > >-- 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.
> Thanks Chris, that''s helpful. I am wondering if I should be mixing > Ruby DSL manifests with the Puppet DSL manifests. Is there any > recommended practice for keeping both styles together?Afaik you can mix both DSL. If one file in a module ends with .rb it''s ruby dsl, if it ends with .pp it''s puppet dsl. Obviously they shouldn''t have the same name. But if you only use modules and follow the autoloading rules (one define/class per file with the same name as the filename/heirarchy) you won''t name a file twice with the same name anyway.> Also, does Ruby > DSL get converted into Puppet DSL before execution?Both, puppet and ruby DSL get compiled as a catalog, which is then sent to the client and applied there. The same goes for the standalone mode, where the client just applies the catalog it compiled before. So in both ways they end up in the same abstract target, called catalog. If you''re switchting to client/server mode, the only thing that you need to consider is that ruby-dsl files (as the puppet dsl files) are parsed and compiled on the master. This means that if you have in these ruby-dsl files any file-operations, binary executions etc. without using the proper puppet providers, your ruby code will be executed on the master. As it goes with puppet functions, that are also executed on the master at compile time. So having the idea of querying DBs FROM the client while applying the catalog (not to mix with compiling the catalog) or do any other magic using ruby code, won''t work, as this code will always be executed on the master. The client just gets a fixed compiled catalog it applies, nothing else. ~pete
On Wed, Nov 2, 2011 at 3:43 AM, Peter Meier <peter.meier@immerda.ch> wrote:>> Thanks Chris, that''s helpful. I am wondering if I should be mixing >> Ruby DSL manifests with the Puppet DSL manifests. Is there any >> recommended practice for keeping both styles together? > > Afaik you can mix both DSL. If one file in a module ends with .rb it''s > ruby dsl, if it ends with .pp it''s puppet dsl. Obviously they shouldn''t > have the same name. > > But if you only use modules and follow the autoloading rules (one > define/class per file with the same name as the filename/heirarchy) you > won''t name a file twice with the same name anyway. > >> Also, does Ruby >> DSL get converted into Puppet DSL before execution? > > Both, puppet and ruby DSL get compiled as a catalog, which is then sent > to the client and applied there. The same goes for the standalone mode, > where the client just applies the catalog it compiled before. So in both > ways they end up in the same abstract target, called catalog. > > If you''re switchting to client/server mode, the only thing that you need > to consider is that ruby-dsl files (as the puppet dsl files) are parsed > and compiled on the master. This means that if you have in these > ruby-dsl files any file-operations, binary executions etc. without using > the proper puppet providers, your ruby code will be executed on the > master. As it goes with puppet functions, that are also executed on the > master at compile time. > > So having the idea of querying DBs FROM the client while applying the > catalog (not to mix with compiling the catalog) or do any other magic > using ruby code, won''t work, as this code will always be executed on the > master. > > The client just gets a fixed compiled catalog it applies, nothing else. > > ~pete > >Thanks for explaining it in detail Peter. The Ruby DSL manifest includes some binary executable operations, but they are in Puppet context (using Puppet''s exec type). - thanks neubyr -- 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.