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.

Posted in chocolatey, howto, puppet | Tagged , | 1 Comment

Puppet: Making Windows Awesome Since 2011

imagePuppet was one of the first configuration management (CM) tools to support Windows, way back in 2011. It has the heaviest investment on Windows infrastructure with 1/3 of the platform client development staff being Windows folks.  It appears that Microsoft believed an end state configuration tool like Puppet was the way forward, so much so that they cloned Puppet’s DSL (domain-specific language) in many ways and are calling it PowerShell DSC.

Puppet Labs is pushing the envelope on Windows. Here are several things to note:

It can be overwhelming learning a new tool like Puppet at first, but Puppet Labs has some resources to help you on that path. Take a look at the Learning VM, which has a quest-based learning tool. For real-time questions, feel free to drop onto #puppet on freenode.net (yes, some folks still use IRC) with questions, and #puppet-dev with thoughts/feedback on the language itself. You can subscribe to puppet-users / puppet-dev mailing lists. There is also ask.puppetlabs.com for questions and Server Fault if you want to go to a Stack Exchange site. There are books written on learning Puppet. There are even Puppet User Groups (PUGs) and other community resources!

Puppet does take some time to learn, but with anything you need to learn, you need to weigh the benefits versus the ramp up time. I learned NHibernate once, it had a very high ramp time back then but was the only game on the street. Puppet’s ramp up time is considerably less than that. The advantage is that you are learning a DSL, and it can apply to multiple platforms (Linux, Windows, OS X, etc.) with the same Puppet resource constructs.

As you learn Puppet you may wonder why it has a DSL instead of just leveraging the language of Ruby (or maybe this is one of those things that keeps you up wondering at night). I like the DSL over a small layer on top of Ruby. It allows the Puppet language to be portable and go more places. It makes you think about the end state of what you want to achieve in a declarative sense instead of in an imperative sense.

You may also find that right now Puppet doesn’t run manifests (scripts) in order of the way resources are specified. This is the number one learning point for most folks. As a long time consternation of some folks about Puppet, manifest ordering was not possible in the past. In fact it might be why some other CMs exist! As of 3.3.0, Puppet can do manifest ordering, and it will be the default in Puppet 4. http://puppetlabs.com/blog/introducing-manifest-ordered-resources

You may have caught earlier that I mentioned PowerShell DSC. But what about DSC? Shouldn’t that be what Windows users want to choose? Other CMs are integrating with DSC, will Puppet follow suit and integrate with DSC? The biggest concern that I have with DSC is it’s lack of visibility in fine-grained reporting of changes (which Puppet has). The other is that it is a very young Microsoft product (pre version 3, you know what they say :) ). I tried getting it working in December and ran into some issues. I’m hoping that newer releases are there that actually work, it does have some promising capabilities, it just doesn’t quite come up to the standard of something that should be used in production. In contrast Puppet is almost a ten year old language with an active community! It’s very stable, and when trusting your business to configuration management, you want something that has been around awhile and has been proven. Give DSC another couple of releases and you might see more folks integrating with it. That said there may be a future with DSC integration. Portability and fine-grained reporting of configuration changes are reasons to take a closer look at Puppet on Windows.

Yes, Puppet on Windows is here to stay and it’s continually getting better folks.

Posted in puppet | Tagged , | 1 Comment

blogger { ‘Rob Reynolds’: ensure => present }

Howdy. My name is Rob. I currently have a long time blog at http://ferventcoder.com where I talk about all kinds of things including tools and code that seems useful. I used to blog with Devlicio.us (the sister site) where I showed the code instead of just talking about it. I plan to continue that tradition here. I appreciate the opportunity to share perspectives and thoughts with the community as part of the CodeBetter family.

Thanks for having me and expect to hear more about Chocolatey and Puppet.

Posted in chocolatey, puppet | Tagged , | 1 Comment

OpenRasta: Today and tomorrow

The OpenRasta community has experienced a bit of a renaissance. And so it should, for there is much to rejoice about, and really cool stuff happening in the pipeline.

Because the time is right to reopen those communication channels we once had, the community is organising an OpenRasta MeetUp to talk about where we are and where we’re going, with great presentations, nifty additions to the openrasta family and a few reveals of where we’re going.

Come join us, at the just-eat offices, for an amazing evening of tech, beer and probably some food, on August the 22nd.

The Future of OpenRasta

Friday, Aug 22, 2014, 6:30 PM

Location details are available to members only.

41 Developers Attending

Talkers are to being scheduled, if you would like to talk please contact us.

Check out this Meetup →

Posted in Uncategorized | Leave a comment

Using Grunt-TSD w/ Node

If you are a fan of Typescript I assume you are well aware of the amazing type definition repository over at definitelytyped.org. This repository is great because it provides a definitive source for type definitions for pretty much every major JavaScript library.

If you are a fan of Node.js and JavaScript I have to assume that you are a fan of Grunt (or Gulp, your choice). You can use Grunt to automate pretty much every action needed when building HTML/JavaScript applications. Did you know you can also use Grunt to automate the retrieval of update type definitions from the DefinitelyTyped repository? Yup, you can. You simply need to use the Grunt-TSD plugin.

Here is how:

Reference the Grunt-TSD Plugin:
Simply NPM install the plugin using ‘npm install grunt-tsd –save-dev’

Add reference to the plugin inside your Grunt Script:
grunt.loadNpmTasks(‘grunt-tsd’);

Create a tsd.json file
In my opinion it is a bit cleaner to put your tsd configuration external to the grunt script, because of this I am following the path of creating a tds.json file. Make sure you create this file local to your gruntfile.js file. Below is my sample tsd.json file
tsdjson
Please note that the Path:typings entry in the tsd.json configuration is configurable. I wanted my d.ts files put into a ‘typings’ folder in my root. Of course you can change the name or location of this folder if you wish.

Download and install a Type Definition
In order to use a Type Definition you need to install it via TSD. To do this open your cmd prompt and CD into the directory which has your tsd.json file. Once there you can issue the following command ‘tsd query [package name] install -s -o’. This will install your package and update the tsd.json configuration files. For a full overview of the TSD syntax check out the TSD readme

Adding the TSD configuration to your Grunt file
After you have created your tsd.json file we need to create our configuration node inside of grunt. Below is my sample configuration.
tsd

Add the TSD task to a Registered Task
Once you have your TSD configuration node setup the last thing you will need to do is to call this from one of your Registered Tasks in your file.

Once you have all this setup you should be ready to roll. Simply issue a Grunt call to your configuration task (or use Grunt tsd) and watch the magic happen. To validate this worked as expected simply check you typings folder.

Till next time,

Posted in Grunt, TypeScript | Leave a comment