apologies if this shows up twice, I sent it via email and it appears that it never appeared, so I''m posting this again through the google- groups interface. I''m trying to get some require stuff in my puppet manifests to work (as I think they should) but something is wrong. I''m trying to do a require => Class["module::subclass::subclass::class"] but it is not working. My current directory structure is as follows: modules/services/{files,templates,manifests} modules/packages/{files,templates,manifests} modules/firewall/{files,templates,manifests} firewall/manifests/init.pp, etc firewall/manifests/rules/{client,server}/rule_name.pp manifests/{site.pp, nodes.pp, baseline.pp, etc} So I have built a module to construct a firewall based upon some static scripts and fragments, which is working great. In my baseline.pp I can do something like Include firewall::rules::server::allow_ssh and everything works as intended. My problem is that I don''t want to do all of these in my baseline manifest. I also have manifests in the packages and services module that handle package installation and service operations. For example in my ssh manifest in the packages module I can do something like Notify => Class["services::ssh"] and this works as intended, but if I try to do a require => Class["firewall::rules::server::allow_ssh"] puppet complains that it can''t locate the dependency. How can I get this to work? I''m currently using puppet 2.6.6 and facter 1.6.0 on RHEL 6.1 server. -- 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 Aug 2, 9:51 am, Stephen Bunn <scb...@sbunn.org> wrote:> apologies if this shows up twice, I sent it via email and it appears > that it never appeared, so I''m posting this again through the google- > groups interface.Strange, they both appeared in my inbox at the same time.> try to do a require => Class["firewall::rules::server::allow_ssh"] > puppet complains that it can''t locate the dependency. How can I get > this to work?http://docs.puppetlabs.com/learning/modules1.html#manifests-namespacing-and-autoloading Do you have your module directory structure laid out correctly so Puppet''s auto-loading feature can find it? Assuming the require line above, you must have the following on your file system: modules/firewall/rules/server/allow_ssh.pp You can force your way around that using the ''import'' statement, or putting everything in firewall/init.pp but everyone pretty much agrees this is a nightmare to manage. HTH, -Luke -- 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, Aug 2, 2011 at 10:06 PM, Luke Bigum <Luke.Bigum@lmax.com> wrote:> Strange, they both appeared in my inbox at the same time. >Yes, It appears my messages were sent to a moderator. Perhaps this is done with all messages or just new users for a period of time. Now I know.> > http://docs.puppetlabs.com/learning/modules1.html#manifests-namespacing-and-autoloading > > Do you have your module directory structure laid out correctly so > Puppet''s auto-loading feature can find it? Assuming the require line > above, you must have the following on your file system: > > modules/firewall/rules/server/allow_ssh.pp > > You can force your way around that using the ''import'' statement, or > putting everything in firewall/init.pp but everyone pretty much agrees > this is a nightmare to manage. > > HTH, > > -Luke > > I *think* my module directory structure is laid out correctly. Below is apaste of my module tree. What I find strange is from my manifests/some_file.pp I can use an Include firewall::rules::server::allow_ssh and it works fine. It''s just when I try and use that as a require statement in another module. For now I''m putting a bunch of includes in my baseline.pp but this is less than ideal. I''m hoping someone will be able to point out the error of my ways :) |-manifests |-*nodes.pp, sites.pp, etc |-modules |---crontab |-----files |-----manifests |-----templates |---firewall |-----files |-----manifests |-------rules |---------client |---------server |---------*allow_ssh.pp (class firewall::rules::server::allow_ssh) |-----templates |-------Linux |---------client |---------server |---fsmounts |-----files |-----manifests |-----templates |---hosts |-----files |-----manifests |-----templates |---kernelrtv |-----files |-----manifests |-----templates |---packages |-----files |-------logrotate.d |-------rsyslog.d |-----manifests |-----*ssh.pp (trying to require from here) |-----templates |---profiles |-----files |-------bash_defaults |-------skel |-----manifests |-----templates |---services |-----files |-----manifests |-----templates |---users |-----files |-----manifests |-----templates |---yum |-----files |-----manifests |-----templates |-pconfig -- 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.
I think you''ll need to use both an include and a require. The include makes the class(es) in the file available, the require creates the actual dependency. On Tue, Aug 2, 2011 at 3:02 PM, Stephen Bunn <scbunn@sbunn.org> wrote:> On Tue, Aug 2, 2011 at 10:06 PM, Luke Bigum <Luke.Bigum@lmax.com> wrote: > >> Strange, they both appeared in my inbox at the same time. >> > Yes, It appears my messages were sent to a moderator. Perhaps this is done > with all messages or just new users for a period of time. Now I know. > > >> >> http://docs.puppetlabs.com/learning/modules1.html#manifests-namespacing-and-autoloading >> >> Do you have your module directory structure laid out correctly so >> Puppet''s auto-loading feature can find it? Assuming the require line >> above, you must have the following on your file system: >> >> modules/firewall/rules/server/allow_ssh.pp >> >> You can force your way around that using the ''import'' statement, or >> putting everything in firewall/init.pp but everyone pretty much agrees >> this is a nightmare to manage. >> >> HTH, >> >> -Luke >> >> I *think* my module directory structure is laid out correctly. Below is a > paste of my module tree. What I find strange is from my > manifests/some_file.pp I can use an Include > firewall::rules::server::allow_ssh and it works fine. It''s just when I try > and use that as a require statement in another module. For now I''m putting a > bunch of includes in my baseline.pp but this is less than ideal. I''m hoping > someone will be able to point out the error of my ways :) > > |-manifests > |-*nodes.pp, sites.pp, etc > |-modules > |---crontab > |-----files > |-----manifests > |-----templates > |---firewall > |-----files > |-----manifests > |-------rules > |---------client > |---------server > |---------*allow_ssh.pp (class firewall::rules::server::allow_ssh) > |-----templates > |-------Linux > |---------client > |---------server > |---fsmounts > |-----files > |-----manifests > |-----templates > |---hosts > |-----files > |-----manifests > |-----templates > |---kernelrtv > |-----files > |-----manifests > |-----templates > |---packages > |-----files > |-------logrotate.d > |-------rsyslog.d > |-----manifests > |-----*ssh.pp (trying to require from here) > |-----templates > |---profiles > |-----files > |-------bash_defaults > |-------skel > |-----manifests > |-----templates > |---services > |-----files > |-----manifests > |-----templates > |---users > |-----files > |-----manifests > |-----templates > |---yum > |-----files > |-----manifests > |-----templates > |-pconfig > > > > -- > 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 Aug 2, 5:16 pm, Aaron Grewell <aaron.grew...@gmail.com> wrote:> I think you''ll need to use both an include and a require. The include makes > the class(es) in the file available, the require creates the actual > dependency.Yes, if the class in question is not otherwise ''include''d then it needs to be. You must have an ''include'' of it in scope everywhere you reference it. Provided that it is not parameterized, it is safe to ''include'' the class anywhere and everywhere that you reference it, though you may be able to reduce the number includes with some thought and planning. Be careful however: it is not quite right to say "include makes the class(es) in the file available." That''s what ''import'' does, and it looks like you have already structured things so that you don''t need explicit imports (good form, that). ''Include'', on the other hand, specifies that the class''s resources should be included in the current node''s catalog. To draw an (imperfect) analogy with C, ''import foo'' is like #including a header file, whereas ''include foo'' is more like calling a function. John -- 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 Wed, Aug 3, 2011 at 9:20 AM, jcbollinger <John.Bollinger@stjude.org>wrote:> > On Aug 2, 5:16 pm, Aaron Grewell <aaron.grew...@gmail.com> wrote: > > I think you''ll need to use both an include and a require. The include > makes > > the class(es) in the file available, the require creates the actual > > dependency. > > Yes, if the class in question is not otherwise ''include''d then it > needs to be. You must have an ''include'' of it in scope everywhere you > reference it. Provided that it is not parameterized, it is safe to > ''include'' the class anywhere and everywhere that you reference it, > though you may be able to reduce the number includes with some thought > and planning. > > Be careful however: it is not quite right to say "include makes the > class(es) in the file available." That''s what ''import'' does, and it > looks like you have already structured things so that you don''t need > explicit imports (good form, that). > > ''Include'', on the other hand, specifies that the class''s resources > should be included in the current node''s catalog. To draw an > (imperfect) analogy with C, ''import foo'' is like #including a header > file, whereas ''include foo'' is more like calling a function. > > >This may bite me in the ass one day, but since I''ve been using extlookup and accessing module variables INSIDE the module, I haven''t had a single problem with variable scope. It''s become a non issue. My 2c worth. Doug. -- 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 Aug 3, 12:23 pm, Douglas Garstang <doug.garst...@gmail.com> wrote:> On Wed, Aug 3, 2011 at 9:20 AM, jcbollinger <John.Bollin...@stjude.org>wrote: > > > > > > > > > On Aug 2, 5:16 pm, Aaron Grewell <aaron.grew...@gmail.com> wrote: > > > I think you''ll need to use both an include and a require. The include > > makes > > > the class(es) in the file available, the require creates the actual > > > dependency. > > > Yes, if the class in question is not otherwise ''include''d then it > > needs to be. You must have an ''include'' of it in scope everywhere you > > reference it. Provided that it is not parameterized, it is safe to > > ''include'' the class anywhere and everywhere that you reference it, > > though you may be able to reduce the number includes with some thought > > and planning. > > > Be careful however: it is not quite right to say "include makes the > > class(es) in the file available." That''s what ''import'' does, and it > > looks like you have already structured things so that you don''t need > > explicit imports (good form, that). > > > ''Include'', on the other hand, specifies that the class''s resources > > should be included in the current node''s catalog. To draw an > > (imperfect) analogy with C, ''import foo'' is like #including a header > > file, whereas ''include foo'' is more like calling a function. > > This may bite me in the ass one day, but since I''ve been using extlookup and > accessing module variables INSIDE the module, I haven''t had a single problem > with variable scope. It''s become a non issue. My 2c worth.Doug, I think you posted this to the wrong thread. I do like extlookup(), though, and using it can definitely help in avoiding trouble with variable scoping. John -- 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 Wed, Aug 3, 2011 at 2:56 PM, jcbollinger <John.Bollinger@stjude.org>wrote:> > > On Aug 3, 12:23 pm, Douglas Garstang <doug.garst...@gmail.com> wrote: > > On Wed, Aug 3, 2011 at 9:20 AM, jcbollinger <John.Bollin...@stjude.org > >wrote: > > > > > > > > > > > > > > > > > On Aug 2, 5:16 pm, Aaron Grewell <aaron.grew...@gmail.com> wrote: > > > > I think you''ll need to use both an include and a require. The > include > > > makes > > > > the class(es) in the file available, the require creates the actual > > > > dependency. > > > > > Yes, if the class in question is not otherwise ''include''d then it > > > needs to be. You must have an ''include'' of it in scope everywhere you > > > reference it. Provided that it is not parameterized, it is safe to > > > ''include'' the class anywhere and everywhere that you reference it, > > > though you may be able to reduce the number includes with some thought > > > and planning. > > > > > Be careful however: it is not quite right to say "include makes the > > > class(es) in the file available." That''s what ''import'' does, and it > > > looks like you have already structured things so that you don''t need > > > explicit imports (good form, that). > > > > > ''Include'', on the other hand, specifies that the class''s resources > > > should be included in the current node''s catalog. To draw an > > > (imperfect) analogy with C, ''import foo'' is like #including a header > > > file, whereas ''include foo'' is more like calling a function. > > > > This may bite me in the ass one day, but since I''ve been using extlookup > and > > accessing module variables INSIDE the module, I haven''t had a single > problem > > with variable scope. It''s become a non issue. My 2c worth. > > > Doug, I think you posted this to the wrong thread. I do like > extlookup(), though, and using it can definitely help in avoiding > trouble with variable scoping. > > >I was saying that the use of extlookup negates variable scoping problems. Doug. -- 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.