如何在我的本地 PC 上安装 "Puppet module tool"?

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

我希望开始为 Puppet 编写一个模块。 Puppet 的 official documentation for writing modules 推荐如下:

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.

不幸的是,我的本地 PC 上似乎没有安装 Puppet 模块工具,Puppet 的文档也不是很清楚如何安装它。

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.

但乍一看,我的 PC 似乎不属于这两个类别。我没有使用 Puppet 配置我的本地 PC,也没有使用我的本地 PC 作为服务器来管理我的基础设施。我只是想在我的本地机器上使用 Puppet CLI 来生成一个模块。

我也找到了 a GitHub repo for the Puppet module tool,但自述文件指出独立工具已被弃用,因为它现在内置于 Puppet 中。

我需要安装什么才能在我的机器上使用 Puppet 模块工具?有没有我不知何故缺少的 Puppet SDK?

通常人们使用 bundler 来引入 Puppet 及其依赖项;然后你 运行 从你的包中的 Puppet。

您需要的先决条件:

  • Ruby
  • Ruby 宝石

然后

$ gem install bundler

在您的项目目录中:

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

$ bundle install 

现在您可以运行:

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