We''ve been pretty much a homogenous CentOS environment until recently. Actually, we''ve had a mixture of CentOS, Ubuntu and Debian because a previous admin thought this would be ''fun''. Grrrr. Anyway, I tried to add an Ubuntu system for the first time. My site.pp file has a ''yum clean all'' dependency that gets run before any package is installed to make sure it always gets the latest copy of what''s available on the repo. I don''t want/need this to run for Ubuntu systems. I wasn''t able to get this to run for only CentOS. I tried a few different things in the site.pp. I wish I could put a case statement inside the exec, but puppet doesn''t like that. So, below is what I had originally... how can I get the exec["yum-clean-all"] to only run for CentOS and not Ubuntu? Package { provider => $operatingsystem ? { debian => aptitude, redhat => yum, centos => yum, ubuntu => apt, }, } exec { "yum-clean-all": command => "/usr/bin/yum clean all"; } -- 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 wasn''t able to get this to run for only CentOS. I tried a few > different things in the site.pp. I wish I could put a case statement > inside the exec, but puppet doesn''t like that. So, below is what I had > originally... how can I get the exec["yum-clean-all"] to only run for > CentOS and not Ubuntu? > >I make different classes. So the yum command would be in a class called foo::centos. I might have an exec{ "aptitude update"} in a class called foo::ubuntu, and a line in the class foo that went something like: include foo::$operatingsystem. Might even be able to scratch up an example. J. -- 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 Mon, Apr 26, 2010 at 8:58 AM, Julian Simpson <simpsonjulian@gmail.com> wrote:> >> I wasn''t able to get this to run for only CentOS. I tried a few >> different things in the site.pp. I wish I could put a case statement >> inside the exec, but puppet doesn''t like that. So, below is what I had >> originally... how can I get the exec["yum-clean-all"] to only run for >> CentOS and not Ubuntu? >> > > I make different classes. So the yum command would be in a class called > foo::centos. I might have an exec{ "aptitude update"} in a class called > foo::ubuntu, and a line in the class foo that went something like: include > foo::$operatingsystem. Might even be able to scratch up an example.Well that seems ugly. So, every single module needs to include another module just so that it can call exec["yum-clean-all"] ? Just having the include doesn''t guarantee that the exec will be called first, so how do you do that? 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> I wasn''t able to get this to run for only CentOS. I tried a few > different things in the site.pp. I wish I could put a case statementsite.pp is a special file, it doesn''t get evaluated on every run the same way that classes would get. So variables like $operatingsystem can have an unpredictable value in some cases. Best to move this logic to a class. -- R.I.Pienaar -- 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 Mon, Apr 26, 2010 at 9:17 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> I wasn''t able to get this to run for only CentOS. I tried a few >> different things in the site.pp. I wish I could put a case statement > > site.pp is a special file, it doesn''t get evaluated on every run the same way that classes would get. > > So variables like $operatingsystem can have an unpredictable value in some cases. Best to move this logic to a class.It''s been fine so far, but... I really don''t see how this would work. Let''s say I created a class called os::centos, and included this class anywhere I wanted to have the package clean functionality for CentOS. Firstly, how do you guarantee that the package refresh is performed before any of the packages in this module are installed? By using the site.pp file I am guaranteed that it will always run before yum tries to install anything. Actually, I''ve always been a bit fuzzy on what happens with a default Package{} in site.pp AND another default Package{} in a module. What happens if both have a require => ? Which ones takes precedence? Are both performed, or just one of them? The first poster said he would include os::centos in his module. What happens if the module might be running on either CentOS or Ubuntu? I don''t think ''include os::centos'' will work so great on an Ubuntu system. How do you make it dynamic? 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> On Mon, Apr 26, 2010 at 9:17 AM, R.I.Pienaar <rip@devco.net> wrote: > > > > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > > > >> I wasn''t able to get this to run for only CentOS. I tried a few > >> different things in the site.pp. I wish I could put a case > statement > > > > site.pp is a special file, it doesn''t get evaluated on every run the > same way that classes would get. > > > > So variables like $operatingsystem can have an unpredictable value > in some cases. Best to move this logic to a class. > > It''s been fine so far, but... > > I really don''t see how this would work. Let''s say I created a class > called os::centos, and included this class anywhere I wanted to have > the package clean functionality for CentOS. Firstly, how do you > guarantee that the package refresh is performed before any of the > packages in this module are installed? By using the site.pp file I amfirst thing that jumps to mind is.. class os::setup { include "os::setup::$operatingsystem" } package{"foo": require => Class["os::setup"] . } you could also use a define to wrap the package command ensuring it gets done. -- R.I.Pienaar -- 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.
> The first poster said he would include os::centos in his module. What > happens if the module might be running on either CentOS or Ubuntu? I > don''t think ''include os::centos'' will work so great on an Ubuntu > system. How do you make it dynamic? >By using the $operatingsystem variable in the include. You can make an empty os::ubuntu class in a couple of lines if you have no resources to declare. -- The First Poster Software Build and Deployment http://www.build-doctor.com http://twitter.com/builddoctor -- 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 Mon, Apr 26, 2010 at 9:31 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> On Mon, Apr 26, 2010 at 9:17 AM, R.I.Pienaar <rip@devco.net> wrote: >> > >> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >> > >> >> I wasn''t able to get this to run for only CentOS. I tried a few >> >> different things in the site.pp. I wish I could put a case >> statement >> > >> > site.pp is a special file, it doesn''t get evaluated on every run the >> same way that classes would get. >> > >> > So variables like $operatingsystem can have an unpredictable value >> in some cases. Best to move this logic to a class. >> >> It''s been fine so far, but... >> >> I really don''t see how this would work. Let''s say I created a class >> called os::centos, and included this class anywhere I wanted to have >> the package clean functionality for CentOS. Firstly, how do you >> guarantee that the package refresh is performed before any of the >> packages in this module are installed? By using the site.pp file I am > > first thing that jumps to mind is.. > > class os::setup { > include "os::setup::$operatingsystem" > } > > package{"foo": > require => Class["os::setup"] > . > } > > you could also use a define to wrap the package command ensuring it gets done.Putting a require in every single package{} in every single module really isn''t feasible. How can I have a global package requires? Maybe.... site.pp? -- 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> On Mon, Apr 26, 2010 at 9:31 AM, R.I.Pienaar <rip@devco.net> wrote: > > > > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > > > >> On Mon, Apr 26, 2010 at 9:17 AM, R.I.Pienaar <rip@devco.net> > wrote: > >> > > >> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> > > >> >> I wasn''t able to get this to run for only CentOS. I tried a few > >> >> different things in the site.pp. I wish I could put a case > >> statement > >> > > >> > site.pp is a special file, it doesn''t get evaluated on every run > the > >> same way that classes would get. > >> > > >> > So variables like $operatingsystem can have an unpredictable > value > >> in some cases. Best to move this logic to a class. > >> > >> It''s been fine so far, but... > >> > >> I really don''t see how this would work. Let''s say I created a > class > >> called os::centos, and included this class anywhere I wanted to > have > >> the package clean functionality for CentOS. Firstly, how do you > >> guarantee that the package refresh is performed before any of the > >> packages in this module are installed? By using the site.pp file I > am > > > > first thing that jumps to mind is.. > > > > class os::setup { > > include "os::setup::$operatingsystem" > > } > > > > package{"foo": > > require => Class["os::setup"] > > . > > } > > > > you could also use a define to wrap the package command ensuring it > gets done. > > Putting a require in every single package{} in every single module > really isn''t feasible. How can I have a global package requires? > Maybe.... site.pp?Like I said, use a define. Or since the class name that you need to require is now static across all machines putting it in site.pp will work. -- 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 Mon, Apr 26, 2010 at 9:37 AM, Julian Simpson <simpsonjulian@gmail.com> wrote:> >> The first poster said he would include os::centos in his module. What >> happens if the module might be running on either CentOS or Ubuntu? I >> don''t think ''include os::centos'' will work so great on an Ubuntu >> system. How do you make it dynamic? > > By using the $operatingsystem variable in the include. You can make an > empty os::ubuntu class in a couple of lines if you have no resources to > declare.Let me guess. Apr 26 09:42:29 s_sys@app09.fr.xxx.com puppetd[10289]: Starting Puppet client version 0.24.8 Apr 26 09:42:31 s_sys@app09.fr.xxx.com puppetd[10289]: Could not retrieve catalog: Could not parse for environment production: Syntax error at '':''; expected ''}'' at /etc/puppet/manifests/nodes/fr.xxx.com/app09.pp:22 line 22 being: include opsys::$operatingsystem .... that using facter variables in include statements is not supported in puppet 0.24.8. Friggin brilliant. 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 Mon, Apr 26, 2010 at 9:31 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> On Mon, Apr 26, 2010 at 9:17 AM, R.I.Pienaar <rip@devco.net> wrote: >> > >> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >> > >> >> I wasn''t able to get this to run for only CentOS. I tried a few >> >> different things in the site.pp. I wish I could put a case >> statement >> > >> > site.pp is a special file, it doesn''t get evaluated on every run the >> same way that classes would get. >> > >> > So variables like $operatingsystem can have an unpredictable value >> in some cases. Best to move this logic to a class. >> >> It''s been fine so far, but... >> >> I really don''t see how this would work. Let''s say I created a class >> called os::centos, and included this class anywhere I wanted to have >> the package clean functionality for CentOS. Firstly, how do you >> guarantee that the package refresh is performed before any of the >> packages in this module are installed? By using the site.pp file I am > > first thing that jumps to mind is.. > > class os::setup { > include "os::setup::$operatingsystem" > } > > package{"foo": > require => Class["os::setup"] > . > } > > you could also use a define to wrap the package command ensuring it gets done.Do defines get excuted before everything else in a module? That''s really not clear, and I''m not sure if it''s documented. It also seems that putting facter variables in include statements is not supported in puppet 0.24.8. :( 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> include opsys::$operatingsystemthey are, you didnt read my example properly. -- 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 Mon, Apr 26, 2010 at 9:48 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> include opsys::$operatingsystem > > they are, you didnt read my example properly.Ah, quotes... -- 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.
> include opsys::$operatingsysteminclude "opsys::${operatingsystem}" cheers pete -- 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 Mon, Apr 26, 2010 at 9:55 AM, Peter Meier <peter.meier@immerda.ch> wrote:> >> include opsys::$operatingsystem > > include "opsys::${operatingsystem}"Well, that''s weird. Now I am getting this: Apr 26 09:58:15 s_sys@app09.fr.xxx.com puppetd[12785]: Could not retrieve catalog: Syntax error at ''::CentOS'' at /etc/puppet/modules/opsys/manifests/init.pp:1 on node app09.fr.xxx.com where the include has: include "opsys::${operatingsystem}" and the module opsys has at line in init.pp: class opsys::CentOS { } 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.
> class opsys::CentOS {class opsys::centos { cheers pete -- 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> Apr 26 09:58:15 s_sys@app09.fr.xxx.com puppetd[12785]: Could not > retrieve catalog: Syntax error at ''::CentOS'' at > /etc/puppet/modules/opsys/manifests/init.pp:1 on node > app09.fr.xxx.com > > where the include has: > > include "opsys::${operatingsystem}" > > and the module opsys has at line in init.pp: > > class opsys::CentOS { > } >right, classes cant have Caps as the first char (or maybe even anywhere? not sure). anyway, you''d probably need to look at a case statement then that includes opsys::centos for $operatingsystem == CentOS and similar for your other operating systems. :( puppet really needs a downcase function. -- R.I.Pienaar -- 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 Mon, Apr 26, 2010 at 10:02 AM, Peter Meier <peter.meier@immerda.ch> wrote:>> class opsys::CentOS { > > class opsys::centos {But... app09 ~:# facter | grep "operatingsystem =>" operatingsystem => CentOS facter reports CentOS, not centos 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.
> right, classes cant have Caps as the first char (or maybe even > anywhere? not sure). > > anyway, you''d probably need to look at a case statement then that > includes opsys::centos for $operatingsystem == CentOS and similar > for your other operating systems. :(puppet does that already for us: $ cat test.pp class test::debian { notice("why don''t you test? Fact: ${operatingsystem}") } include "test::${operatingsystem}" $ puppet test.pp notice: Scope(Class[test::debian]): why don''t you test? Fact: Debian> puppet really needs a downcase function.should be straighforward to implement, not? cheers pete -- 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 Mon, Apr 26, 2010 at 10:03 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> Apr 26 09:58:15 s_sys@app09.fr.xxx.com puppetd[12785]: Could not >> retrieve catalog: Syntax error at ''::CentOS'' at >> /etc/puppet/modules/opsys/manifests/init.pp:1 on node >> app09.fr.xxx.com >> >> where the include has: >> >> include "opsys::${operatingsystem}" >> >> and the module opsys has at line in init.pp: >> >> class opsys::CentOS { >> } >> > > right, classes cant have Caps as the first char (or maybe even anywhere? not sure). > > anyway, you''d probably need to look at a case statement then that includes opsys::centos for $operatingsystem == CentOS and similar for your other operating systems. :( > > puppet really needs a downcase function.Well that''s weird and mildly confusing. The class is opsys::centos but we''re really including opsys::CentOS. Nice. Anyway, so lets say I now have this in my opssys::centos class class opsys::centos { Package { require => Exec["yum-clean-all"] } exec { "yum-clean-all": command => "/usr/bin/yum clean all"; } } and I include it in every single module (shame I can''t include it at site.pp). As far as I know, including one class in another does not guarantee that the other class gets evaluated first, even though the other class has a default Package{} .... or does it? Docs on this stuff in puppet are really murky. 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.
----- "Peter Meier" <peter.meier@immerda.ch> wrote:> > right, classes cant have Caps as the first char (or maybe even > > anywhere? not sure). > > > > anyway, you''d probably need to look at a case statement then that > > includes opsys::centos for $operatingsystem == CentOS and similar > > for your other operating systems. :( > > puppet does that already for us: > > $ cat test.pp > class test::debian { > notice("why don''t you test? Fact: ${operatingsystem}") > } > > include "test::${operatingsystem}" > $ puppet test.pp > notice: Scope(Class[test::debian]): why don''t you test? Fact: Debiannice, didn''t know include downcases things - I just always avoided the situation :) I did test, but my test was lame and so did something stupid that failed :P> > > puppet really needs a downcase function. > > should be straighforward to implement, not?yup, but not needed it seems :) -- 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.
> and I include it in every single module (shame I can''t include it at > site.pp). As far as I know, including one class in another does not > guarantee that the other class gets evaluated first, even though the > other class has a default Package{} .... or does it? Docs on this > stuff in puppet are really murky.where do you include opsys::$operatingsystem at the moment? show us your entire current code so we know. My intended design was that in site.pp you could do Package{ require => Class["opsys::setup"] } and retain that functionality -- R.I.Pienaar -- 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 Mon, Apr 26, 2010 at 10:20 AM, R.I.Pienaar <rip@devco.net> wrote:>> and I include it in every single module (shame I can''t include it at >> site.pp). As far as I know, including one class in another does not >> guarantee that the other class gets evaluated first, even though the >> other class has a default Package{} .... or does it? Docs on this >> stuff in puppet are really murky. > > where do you include opsys::$operatingsystem at the moment? show us your entire current code so we know. > > My intended design was that in site.pp you could do Package{ require => Class["opsys::setup"] } and retain that functionalityI don''t include opsys::$operatingsystem anywhere at the moment. I was going to start putting it every single module which seems ugly. I hadn''t thought of the the idea of putting it in site.pp the way you just did... I''ll give that a shot. 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.
> Well that''s weird and mildly confusing. The class is opsys::centos but > we''re really including opsys::CentOS. Nice.because puppet can''t have any classes started with capitalized letters (global resource identifier clash) and anything else behind is anyway downcased (class tEST == class test), include downcases automatically for you: $ cat foo.pp class test { notice("yupiiii!") } include Test $ puppet foo.pp notice: Scope(Class[test]): yupiiii! cheers pete -- 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 Mon, Apr 26, 2010 at 10:23 AM, Douglas Garstang <doug.garstang@gmail.com> wrote:> On Mon, Apr 26, 2010 at 10:20 AM, R.I.Pienaar <rip@devco.net> wrote: >>> and I include it in every single module (shame I can''t include it at >>> site.pp). As far as I know, including one class in another does not >>> guarantee that the other class gets evaluated first, even though the >>> other class has a default Package{} .... or does it? Docs on this >>> stuff in puppet are really murky. >> >> where do you include opsys::$operatingsystem at the moment? show us your entire current code so we know. >> >> My intended design was that in site.pp you could do Package{ require => Class["opsys::setup"] } and retain that functionality > > I don''t include opsys::$operatingsystem anywhere at the moment. I was > going to start putting it every single module which seems ugly. I > hadn''t thought of the the idea of putting it in site.pp the way you > just did... I''ll give that a shot.Actually, that''s not working so well now either. I am getting: Apr 26 10:28:56 s_sys@app09.fr.xxx.com puppetd[19381]: Configuration could not be instantiated: Could not find dependency Class[os::setup] for Package[net-snmp] at /etc/puppet/modules/snmp/manifests/init.pp:31 my site.pp has (amongst other stuff): Package { require => Class["os::setup"] } and the os module has: class os::centos { Package { provider => yum, require => Exec["yum-clean-all"] } exec { "yum-clean-all": command => "/usr/bin/yum clean all"; } } class os::setup { include "os::${operatingsystem}" } So, apparently the net-snmp module can''t find os::setup class. Not sure why... 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 Mon, 26 Apr 2010, R.I.Pienaar wrote:> puppet really needs a downcase function.$var = "Mixed CaSe sTUff" $downcased_var = inline_template("<%= var.downcase %>") --apb (Alan Barrett) -- 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.
----- "Douglas Garstang" <doug.garstang@gmail.com> wrote:> So, apparently the net-snmp module can''t find os::setup class. Not > sure why...you need to include it somewhere first. most people have some kind of common class they include on all machines, you''d include it there -- R.I.Pienaar -- 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.
----- "Alan Barrett" <apb@cequrux.com> wrote:> On Mon, 26 Apr 2010, R.I.Pienaar wrote: > > puppet really needs a downcase function. > > $var = "Mixed CaSe sTUff" > $downcased_var = inline_template("<%= var.downcase %>")obvious, and obviously ugly :) -- 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 Mon, Apr 26, 2010 at 10:45 AM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >> So, apparently the net-snmp module can''t find os::setup class. Not >> sure why... > > you need to include it somewhere first. > > most people have some kind of common class they include on all machines, you''d include it thereBut... include what? I mean, every module is going to use site.pp and site.pp includes os::setup, so why do I need to include it in every module? This is really bugging me. Puppet is starting to look more and more like Perl every day. There''s no good way to do everything. 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.
Your site.pp should look like: include os::setup Package { require => Class["os::setup"] } other wise the classes is not avaiable, how should puppet set a relation to something that is not included in its manifests? cheers pete -- 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 Mon, Apr 26, 2010 at 10:51 AM, Peter Meier <peter.meier@immerda.ch> wrote:> Your site.pp should look like: > > include os::setup > Package { > require => Class["os::setup"] > } > > other wise the classes is not avaiable, how should puppet set a relation to > something that is not included in its manifests?Oh, well... that''s also ugly. :( -- 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.
>> Your site.pp should look like: >> >> include os::setup >> Package { >> require => Class["os::setup"] >> } >> >> other wise the classes is not avaiable, how should puppet set a relation to >> something that is not included in its manifests? > > Oh, well... that''s also ugly. :(what? -- 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 27/04/2010 2:17 AM, R.I.Pienaar wrote:> > ----- "Douglas Garstang"<doug.garstang@gmail.com> wrote: > >> I wasn''t able to get this to run for only CentOS. I tried a few >> different things in the site.pp. I wish I could put a case statement > > site.pp is a special file, it doesn''t get evaluated on every run the same way that classes would get.Weird - if this is the case it''s definitely a bug (hint... :) ). Regards James -- Author of: * Pro Linux System Administration (http://tinyurl.com/linuxadmin) * Pulling Strings with Puppet (http://tinyurl.com/pupbook) * Pro Nagios 2.0 (http://tinyurl.com/pronagios) * Hardening Linux (http://tinyurl.com/hardeninglinux) -- 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.
AFAIK, it does get evaluated each time :) On Tue, Apr 27, 2010 at 8:02 AM, James Turnbull <james@lovedthanlost.net>wrote:> On 27/04/2010 2:17 AM, R.I.Pienaar wrote: > >> >> ----- "Douglas Garstang"<doug.garstang@gmail.com> wrote: >> >> I wasn''t able to get this to run for only CentOS. I tried a few >>> different things in the site.pp. I wish I could put a case statement >>> >> >> site.pp is a special file, it doesn''t get evaluated on every run the same >> way that classes would get. >> > > Weird - if this is the case it''s definitely a bug (hint... :) ). > > Regards > > James > > -- > Author of: > * Pro Linux System Administration (http://tinyurl.com/linuxadmin) > * Pulling Strings with Puppet (http://tinyurl.com/pupbook) > * Pro Nagios 2.0 (http://tinyurl.com/pronagios) > * Hardening Linux (http://tinyurl.com/hardeninglinux) > > > -- > 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<puppet-users%2Bunsubscribe@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, Apr 27, 2010 at 1:03 AM, R.I.Pienaar <rip@devco.net> wrote:> > puppet really needs a downcase function. > > -- > > module Puppet::Parser::Functionsnewfunction(:downcase, :type => :rvalue) do |args| args[0].downcase end end Ohad -- 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 27 Apr 2010, at 02:37, Ohad Levy <ohadlevy@gmail.com> wrote:> AFAIK, it does get evaluated each time :)When I first did extlookup i tried to set the look up order using normal vars like below in site.pp $extlookup_precedence = ["$fqdn"] This failed on 24 it would get blanks or wrong ones Maybe it''s fixed in 25?> > On Tue, Apr 27, 2010 at 8:02 AM, James Turnbull <james@lovedthanlost.net> wrote: > On 27/04/2010 2:17 AM, R.I.Pienaar wrote: > > ----- "Douglas Garstang"<doug.garstang@gmail.com> wrote: > > I wasn''t able to get this to run for only CentOS. I tried a few > different things in the site.pp. I wish I could put a case statement > > site.pp is a special file, it doesn''t get evaluated on every run the same way that classes would get. > > Weird - if this is the case it''s definitely a bug (hint... :) ). > > Regards > > James > > -- > Author of: > * Pro Linux System Administration (http://tinyurl.com/linuxadmin) > * Pulling Strings with Puppet (http://tinyurl.com/pupbook) > * Pro Nagios 2.0 (http://tinyurl.com/pronagios) > * Hardening Linux (http://tinyurl.com/hardeninglinux) > > > -- > 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.-- 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.
> puppet really needs a downcase function.You can use an inline template: $lc_operatingsystem = inline_template("<%= operatingsystem.downcase - %>") -- 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.