在 Vagrant 部署期间 运行 puppet 模块时找不到 class

Could not find class when running puppet module during Vagrant deploy

我正在寻找通过 Vagrant 1.9.5 部署 CentOS 7 VirtualBox VM,我想 运行 在本地部署一些 puppet 模块。

在我的 Vagrantfile 下方:

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.hostname = "test01.virtual"         

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "puppet/manifests"
    puppet.module_path = "puppet/modules/"
    puppet.options = ['--verbose']
  end
end

和我的 default.pp 文件位于 ./puppet/manifests:

Package { allow_virtual => true }

include mycode-dummy

Puppet 模块似乎没问题:

$ grep class puppet/modules/mycode-dummy/manifests/init.pp
class dummy($path    = '/tmp/dummy',

当我 运行 vagrant up 时,我收到以下错误消息:

....
==> default: Info: Loading facts
==> default: Error: Could not find class mycode-dummy for test01.virtual on node test01.virtual
==> default: Error: Could not find class mycode-dummy for test01.virtual on node test01.virtual
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

其他模块和其他 vagrant boxes 也会发生这种情况。
我没听错...

BR
弹性

您没有调用虚拟对象 class,您包含了一个模块但没有从该模块调用任何内容。

在你的default.pp中你需要有类似

的东西
Package { allow_virtual => true }

class {dummy: }

include dummy