Puppet: Getting Started On Windows
- by Robz / Fervent Coder
Originally posted on: http://geekswithblogs.net/robz/archive/2014/08/07/puppet-getting-started-on-windows.aspxNow that we’ve talked a little about Puppet. Let’s see how easy it is to get started. Install Puppet Let’s get Puppet Installed. There are two ways to do that: With Chocolatey: Open an administrative/elevated command shell and type: choco install puppet
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 have to restart your CLI (command line interface) session or you installed Puppet manually open an administrative/elevated command shell and 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.