1

​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.

Banthita Limwilai
  • 181
  • 1
  • 2
  • 10
  • 1
    There's a lot of information to be found online, like [Getting Started With Puppet Code: Manifests and Modules](https://www.digitalocean.com/community/tutorials/getting-started-with-puppet-code-manifests-and-modules). What do you _actually_ want to install? Because 'Microsoft Azure' is a cloud provider. – rickvdbosch Mar 21 '19 at 09:15
  • thanks for the reply! I wanted to install azure client. – Banthita Limwilai Mar 21 '19 at 09:16
  • 2
    It sounds like you're asking a basic question that might be reasonably rephrased as "How do I make my class *do* something?" That's a bit broad for SO, but I suggest you start with [the architecture overview](https://puppet.com/docs/puppet/5.5/architecture.html) (the Puppet 5 version I've linked, not the Puppet 6 version, which is presently mangled and largely useless). You'll need to choose first between the "master / agent" approach and the "masterless" approach, because where you put the manifest files containing your classes and how you use them depends on that. – John Bollinger Mar 21 '19 at 14:05
  • 2
    You may next want to look at the run-down of [important directories and files](https://puppet.com/docs/puppet/5.5/dirs_important_directories.html). If you are using the agent / master approach, and maybe even if you're going masterless, then you'll also want to know about [environments](https://puppet.com/docs/puppet/5.5/env_environments.html), and especially about how they are laid out. – John Bollinger Mar 21 '19 at 14:12
  • 2
    I presume that you're not using the Puppet PE, since a subscription to that comes with support. In that case, you're probably looking at the [CLI](https://puppet.com/docs/puppet/5.5/services_commands.html) for applying configuration to your target nodes, or else at running the agent as a service. whether [on Windows](https://puppet.com/docs/puppet/5.5/services_commands.html) or [on any of the other supported platforms](https://puppet.com/docs/puppet/5.5/services_agent_unix.html). – John Bollinger Mar 21 '19 at 14:20
  • 2
    Just to clarify: my previous "mangled and largely useless" comment applies to a specific piece of the *documentation*, not to the software. – John Bollinger Mar 21 '19 at 14:22

1 Answers1

2

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.

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97