HassanzDaName
2013-Apr-04 19:15 UTC
[Puppet Users] Solutions to Learning Puppet Exercises?
Hello Everyone in the Puppet World, I''m fairly new to Puppet. I''m still learning the basics. I actually just got done completing the learning section covering variables, conditionals, & facts over on this page: < http://docs.puppetlabs.com/learning/variables.html> Here''s my situation... I''ve completed the exercises near the bottom of the page. I''m not sure if my manifests are right or not. Am I writing the code properly? Do I have the concept down? It is hard to tell. Is there a place online we can find solutions? Would anyone be willing to look over my code? ANY help would be greatly appreciated! For the first exercise: Use the $operatingsystem fact to write a manifest that installs a build environment on Debian-based (“debian,” “ubuntu”) and Enterprise Linux-based (“centos,” “redhat”) machines. (Both types of system require the gcc package, but Debian-type systems also require build-essential.) I have attached a screenshot of my code here... Have I done this correctly? Is anything missing? Thank you in advance! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
For the solutions to the exercises I would send an email to faq@puppetlabs.com as stated on the first page of ''Learning Puppet''. I think it would be good to make them available. For your case, it is not quite what it should be. But as there are many things to learn, you''ll get there. First thing is just for cleaner code, you can shorten duplicate entries to one line, like this: case $operatingsystem { centos, redhat: { $gcc = ''gcc'' } } As you can see, I also single quoted the variable, because that''s according to the Style Guide[1]. I see that this is wrong in the example as well. Second point, is that you can''t really use require like that. Maybe the text pointed you in the wrong direction, what it means is that Debian-type systems actually need two packages. So for the code this would mean: case $operatingsystem { centos, redhat: { $gcc = ''gcc'' } debian, ubuntu: { $gcc = [ ''gcc'', ''build-essential'' ] } } You assigned an array to $gcc, and the package resource will use both of the values in the array. [1]: http://docs.puppetlabs.com/guides/style_guide.html On 04/04/2013 09:15 PM, HassanzDaName wrote:> Hello Everyone in the Puppet World, > > I''m fairly new to Puppet. I''m still learning the basics. I actually > just got done completing the learning section covering variables, > conditionals, & facts over on this page: > <http://docs.puppetlabs.com/learning/variables.html> > > > Here''s my situation... I''ve completed the exercises near the bottom of > the page. I''m not sure if my manifests are right or not. Am I writing > the code properly? Do I have the concept down? It is hard to tell. Is > there a place online we can find solutions? Would anyone be willing to > look over my code? > > > ANY help would be greatly appreciated! > > For the first exercise: Use the $operatingsystem fact to write a > manifest that installs a build environment on Debian-based (“debian,” > “ubuntu”) and Enterprise Linux-based (“centos,” “redhat”) machines. > (Both types of system require the |gcc| package, but Debian-type systems > also require |build-essential|.) > > I have attached a screenshot of my code here... > > Have I done this correctly? Is anything missing? Thank you in advance! > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.