Vagrant+Puppet puppet.module_path not working

最后都变了- 提交于 2019-12-10 20:31:41

问题


So I have my Vagrant file set up like this:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise64"

  config.vm.provision "puppet" do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file  = "site.pp"
    puppet.module_path = "modules"
    puppet.options = "--verbose --debug"
  end
end

Now when I vagrant ssh into my VM and then run puppet module install puppetlabs-apache, i get the following error:

Error: Could not install module 'puppetlabs-apache' (latest) Directory /home/vagrant/.puppet/modules does not exist

So what I tried was:

mkdir -p /home/vagrant/.puppet/modules

followed by:

puppet module install puppetlabs-apache

and it worked!

But the module files are not showing up in my host machine under the "modules" directory that I set in my Vagrantfile. So I guess the puppet.module_path isn't working..?

Thanks :)


回答1:


Invoking puppet inside your VM is not the same as Puppet as it is used for provisioning from the host.

The Puppet resources that Vagrant uses are part of the Vagrant project. As you can see, the Puppet command inside the VM uses either

  • local Puppet config and resources in ~/.puppet or
  • global resources in /etc/puppet

The Puppet configuration is not shared between host and VM.



来源:https://stackoverflow.com/questions/25590651/vagrantpuppet-puppet-module-path-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!