Puppet: Getting Started On Windows

Now that we’ve talked a little about Puppet. Let’s see how easy it is to get started.

Install Puppet

PuppetLet’s get Puppet Installed. There are two ways to do that:

  1. With Chocolatey: Open an administrative/elevated command shell and type:
    choco install puppet
    
  2. Download and install Puppet manually – http://puppetlabs.com/misc/download-options

Run Puppet

  • Let’s make pasting into a console window work with Control + V (like it should):
    choco install wincommandpaste
    
  • If you have a cmd.exe command shell open, (and chocolatey installed) type:
    RefreshEnv
  • The previous command will refresh your environment variables, ala Chocolatey v0.9.8.24+. If you were running PowerShell, there isn’t yet a refreshenv for you (one is coming though!).
  • If you are not able to use RefreshEnv (or ‘where puppet’ evaluates to not found), you need to restart your CLI (command line interface) session or open an administrative/elevated command prompt (because you installed manually).
  • Now let’s find out about the users on the system. Type:
    puppet resource user
    
  • Output should look similar to a few of these:
    user { 'Administrator':
      ensure  => 'present',
      comment => 'Built-in account for administering the computer/domain',
      groups  => ['Administrators'],
      uid     => 'S-1-5-21-some-numbers-yo-500',
    }
    
    
    
  • Let’s create a user:
    puppet apply -e "user {'bobbytables_123': ensure => present, groups => ['Users'], }"
    
  • Relevant output should look like:
    Notice: /Stage[main]/Main/User[bobbytables_123]/ensure: created
    
    
    
  • Run the ‘puppet resource user’ command again. Note the user we created is there!
  • Let’s clean up after ourselves and remove that user we just created:
    puppet apply -e "user {'bobbytables_123': ensure => absent, }"
    
  • Relevant output should look like:
    Notice: /Stage[main]/Main/User[bobbytables_123]/ensure: removed
    
    
  • Run the ‘puppet resource user’ command one last time. Note we just removed a user!

Conclusion

You just did some configuration management /system administration. Welcome to the new world of awesome! Puppet is super easy to get started with. This is a taste so you can start seeing the power of automation and where you can go with it. We haven’t talked about resources, manifests (scripts), best practices and all of that yet.

Next we are going to start to get into more extensive things with Puppet. Next time we’ll walk through getting a Vagrant environment up and running. That way we can do some crazier stuff and when we are done, we can just clean it up quickly.

About Rob Reynolds

Rob Reynolds has been programming in .NET since the early days of 1.0... [Continue reading... at http://about.me/ferventcoder] On this blog you'll find just about anything I find interesting that has to do with development including Puppet and Chocolatey. Because we are all polyglot programmers in our own way, you may see anything from NHibernate to some custom CSS. Nobody is perfect and occasionally I may post something you find incorrect. Please keep me straight! With your help and interaction the community will benefit.
This entry was posted in chocolatey, howto, puppet and tagged , . Bookmark the permalink. Follow any comments here with the RSS feed for this post.