Using Puppet to install Azure client to all nodes

136 views Asked by At

​First, sorry for asking basic and quite silly questions. I'm very newbie and do not have much experience in this kind of operation.

I have read many documents from official site, tutorialspoint(gave me basic concepts of how puppet work) site and else but still confused and don't know where to start.

Since I wanted to install Azure to all slave nodes, I think I have to create classes like

class packages {

  # the first, most obvious solution is
  package { 'screen': ensure => 'installed' }
  package { 'strace': ensure => 'installed' }
  package { 'sudo':   ensure => 'installed' }


  # you can use a global package parameter
  Package { ensure => 'installed' }

  package { 'screen': }
  package { 'strace': }
  package { 'sudo':   }

  # you can specify the packages in an array ...
  $enhancers = [ 'screen', 'strace', 'sudo' ]
  package { $enhancers: ensure => 'installed' }


  # ... and even combine it a global package parameter
  Package { ensure => 'installed' }

  $enhancers = [ 'screen', 'strace', 'sudo' ]

  package { $enhancers: }

}

cr: https://www.puppetcookbook.com/posts/install-multiple-packages.html

But hey! where should I put that code to ?, How can I execute that? they do not tell me T-T

I really appreciate for all your kindness and your answers Thanks

Edited on 26th Mar 2019

Thanks for all the comments, I've read for the architecture and be able to create a class now.

1

There are 1 answers

3
Alex Harvey On

Note that The Puppet Cookbook goes back to the days of Puppet 3. It can still be useful, but it predates modern language features like iteration and data types, and no longer aligns with modern best practices.

Nowadays, I rarely see packages grouped into a class like this by the way. Often, packages are externalised in Hiera as data and read into a class, perhaps a "configure" or "install" class, via a packages parameter. (Not that I'm suggesting there's anything wrong with having a packages class.)

To the main part of your question:

But hey! where should I put that code to ?, How can I execute that? they do not tell me T-T

To learn more about how to organise your classes, you need to learn about the Roles and Profiles pattern.


UPDATE: As pointed out in the comments, you may be confused about more basic things than how to organise your classes. At this point, I should say that Stack Overflow is a site for asking specific questions that have a specific answer.

Do have a look at this page here. My suggestion is to follow the advice in there and join the Puppet Community Slack. People in that forum will be glad to help you get started and answer your questions in real time.