Search code examples
puppet

How do I install the "Puppet module tool" on my local PC?


I'm looking to get started with writing a module for Puppet. Puppet's official documentation for writing modules recommends the following:

To write a module, we strongly suggest running puppet module generate <USERNAME>-<MODULE NAME>

When you run the above command, the Puppet module tool (PMT) will ask a series of questions to gather metadata about your module, and creates a basic module structure for you.

Unfortunately, I don't seem to have the Puppet module tool installed on my local PC, and Puppet's docs aren't very clear on how to install it.

There are instructions on how to set up a Puppet master and Puppet agents:

A computer that runs the Puppet Server is called the “master.” Follow these instructions to install and configure Puppet Server.

A computer that runs the Puppet agent is called a “Puppet agent” or simply “agent”. The Puppet agent regularly pulls configuration catalogs from a master and applies them to the local system.

But at first glance my PC doesn't seem to fit into either of those categories. I'm not using Puppet to configure my local PC, nor am I using my local PC as a server to manage my infrastructure. I simply want to use the Puppet CLI on my local machine to generate a module.

I did also find a GitHub repo for the Puppet module tool, but the README states that the standalone tool has been deprecated as it is now built in to Puppet.

What do I need to install in order to allow the use of the Puppet module tool on my machine? Is there a Puppet SDK somewhere that I'm somehow missing?


Solution

  • Normally people use bundler to pull in Puppet and its dependencies; you then run Puppet from within your bundle.

    The prerequisites you need:

    • Ruby
    • Ruby Gems

    Then

    $ gem install bundler
    

    In your project directory:

    $ vim Gemfile
    source 'https://rubygems.org'
    gem 'puppet'
    

    and

    $ bundle install 
    

    Now you can run:

    $ bundle exec puppet module generate <USERNAME>-<MODULE NAME>