Elizabeth Genco Purvis
2006-Dec-01 16:51 UTC
"All resource specifications require names": wot?
Hi, everyone -- I downloaded puppet and have been playing with it. I''m using the RPM''s for RHE4 created by David (mentioned on the install page: http://people.redhat.com/dlutter/yum/rhel4/) with RHE''s ruby 1.8.1-7: ruby-1.8.1-7.EL4.8 ruby-libs-1.8.1-7.EL4.8 ruby-devel-1.8.1-7.EL4.8 I''m sure this is an easy one; all the same, I''m stumped. Please bear with me as it''s my maiden voyage, both with Puppet and Ruby. We''d like to manage some Apache servers with Puppet. To dip my toe in, I thought I''d try reproducing the example on this page of the docs: http://reductivelabs.com/projects/puppet/documentation/big-picture.html That seems pretty unambiguous to me: create an apache definition (a component), call on it in each node while passing it some parameters. Great. So I made my apache.pp file (with a few modifications): define apache(conf) { $name = httpd package { $name: install => true } file { $conf: source => $conf } service { $name: running => true, requires => [file[$conf], package[$name]] } file { "/tmp/zoinks": ensure => file, mode => 755; "/tmp/andaway": ensure => file, mode => 755 } } And here''s my site.pp file: # site.pp import "apache" node cc62-3 { apache { conf => "/sysadmin/puppet/services/apache2/puppet-test/httpd.conf" } } When I try to start up puppetmasterd, I get the following error: [root@cc68-13 manifests]# /usr/sbin/puppetmasterd start All resource specifications require names in file /etc/puppet/manifests/site.pp at line 8 [root@cc68-13 manifests]# I''m also a little shaky on how one would use classes and components together. I was trying to get something like this to work: class webserver { define apache (conf) { blah blah blah... } } with a node declaration similar to the one above, but when I tried to run it, again, puppet was sad. Any hints on these issues would be great. I''m sure my first problem is due to something really obvious; I''m doing my best to get through the docs and figure it all out. Thanks, Elizabeth _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 01 December 2006 17:51, Elizabeth Genco Purvis wrote:> define apache(conf) { > $name = httpd > > package { $name: > install => true > } > > file { $conf: > source => $conf > } > > service { $name: > running => true, > requires => [file[$conf], package[$name]] > } > > file { > "/tmp/zoinks": ensure => file, mode => 755; > "/tmp/andaway": ensure => file, mode => 755 > } > > } > > And here's my site.pp file: > > # site.pp > import "apache" > > node cc62-3 { > apache { > > conf => "/sysadmin/puppet/services/apache2/puppet-test/httpd.conf" > } > } > > When I try to start up puppetmasterd, I get the following error: > > [root@cc68-13 manifests]# /usr/sbin/puppetmasterd start > All resource specifications require names in file > /etc/puppet/manifests/site.pp at line 8 [root@cc68-13 manifests]#The right way to use the apache define is: apache { some_name: conf => "..." } where "some_name" is the so-called name of this resource specification.> I'm also a little shaky on how one would use classes and components > together. I was trying to get something like this to work: > > class webserver { > > define apache (conf) { > > blah blah blah... > > } > > } > > with a node declaration similar to the one above, but when I tried to run > it, again, puppet was sad.Classes group resource definitions, so you would say: class static_webserver { apache { "images.example.org": conf => "example.conf" } file { "/srv/images.example.org": ensure => directory } } node cluster1, cluster2, cluster3, cluster4 { include static_webserver }> Any hints on these issues would be great. I'm sure my first problem is due > to something really obvious; I'm doing my best to get through the docs and > figure it all out."Beginnings are delicate times ..." -- Frank Herbert, Dune Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFcGwF/Pp1N6Uzh0URAkmOAJ9lcAiaX5trGDLIA5oz3E64ZNJsHgCfcF5O Rng83v1WPFHnKqBRGK5oTwI=xJ9x -----END PGP SIGNATURE----- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
David Lutterkort
2006-Dec-01 17:54 UTC
Re: "All resource specifications require names": wot?
On Fri, 2006-12-01 at 11:51 -0500, Elizabeth Genco Purvis wrote:> I downloaded puppet and have been playing with it. I''m using the > RPM''s for RHE4 created by David (mentioned on the install page: > http://people.redhat.com/dlutter/yum/rhel4/) with RHE''s ruby 1.8.1-7:Cool .. I am glad you find them useful.> http://reductivelabs.com/projects/puppet/documentation/big-picture.htmlThat doc has a small bug (I checked a fix into svn, not sure though when it will hit the website):> And here''s my site.pp file: > > # site.pp > import "apache" > > node cc62-3 { > apache { > > conf => > "/sysadmin/puppet/services/apache2/puppet-test/httpd.conf" > } > }The use of the ''apache'' component is missing a name; that''s been mandatory for the last few versions. The correct syntax is node cc62-3 { apache { apache-cc62-3: conf => "/sysadmin/puppet/services/apache2/puppet-test/httpd.conf" } } The actual name of the apache component (''apache-cc62-3'' above) doesn''t really matter - but there has to be one.> I''m also a little shaky on how one would use classes and components > together. I was trying to get something like this to work: > > class webserver { > > define apache (conf) { > > blah blah blah... > > } > > } > > with a node declaration similar to the one above, but when I tried to > run it, again, puppet was sad.You don''t really need to nest the ''define'' inside the ''class'' (and there has been a bug with that recently) Try doing something like define apache(..) { ... } class webserver { apache { name: ... } } A ''define'' by itself doesn''t really do anything - it''s like declaring a funcion/method or a macro in other languages. Stuff only happens when you use that component. David
On Dec 1, 2006, at 10:51 AM, Elizabeth Genco Purvis wrote:> > Hi, everyone -- > > I downloaded puppet and have been playing with it. I''m using the > RPM''s for RHE4 created by David (mentioned on the install page: > http://people.redhat.com/dlutter/yum/rhel4/) with RHE''s ruby 1.8.1-7: > > ruby-1.8.1-7.EL4.8 > ruby-libs-1.8.1-7.EL4.8 > ruby-devel-1.8.1-7.EL4.8 > > I''m sure this is an easy one; all the same, I''m stumped. Please > bear with me as it''s my maiden voyage, both with Puppet and Ruby. > > We''d like to manage some Apache servers with Puppet. To dip my toe > in, I thought I''d try reproducing the example on this page of the > docs: > > http://reductivelabs.com/projects/puppet/documentation/big- > picture.html > > That seems pretty unambiguous to me: create an apache definition (a > component), call on it in each node while passing it some > parameters. Great. So I made my apache.pp file (with a few > modifications): > > define apache(conf) {The real problem here is with the example: It should use a class instead of a definition, because each of those contained resources are uniqe (that is, you''re not going to have multiple apache services or packages). If a definition is used anyway, then yeah, it must have a name, meaning there must be something between the opening curly and the colon. -- Luke Kanies http://madstop.com | http://reductivelabs.com | 615-594-8199