Vagrant+Puppet puppet.module_path 不工作 [英] Vagrant+Puppet puppet.module_path not working
问题描述
所以我的 Vagrant 文件设置如下:
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
现在,当我 vagrant ssh
进入我的 VM 然后运行 puppet module install puppetlabs-apache
时,我收到以下错误:
Now when I vagrant ssh
into my VM and then run puppet module install puppetlabs-apache
, i get the following error:
错误:无法安装模块puppetlabs-apache"(最新)目录/home/vagrant/.puppet/modules 不存在
所以我尝试的是:
mkdir -p/home/vagrant/.puppet/modules
紧随其后:
puppet 模块安装 puppetlabs-apache
它奏效了!
但是模块文件没有显示在我在 Vagrantfile 中设置的 "modules"
目录下的主机中.所以我猜 puppet.module_path
不起作用..?
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..?
谢谢:)
推荐答案
在 VM 中调用 puppet
与 Puppet 不同,因为它用于从主机进行配置.
Invoking puppet
inside your VM is not the same as Puppet as it is used for provisioning from the host.
Vagrant 使用的 Puppet 资源是 Vagrant 项目的一部分.如您所见,VM 内的 Puppet 命令使用
The Puppet resources that Vagrant uses are part of the Vagrant project. As you can see, the Puppet command inside the VM uses either
~/.puppet
或 中的本地 Puppet 配置和资源/etc/puppet
中的全局资源
- local Puppet config and resources in
~/.puppet
or - global resources in
/etc/puppet
主机和虚拟机之间不共享 Puppet 配置.
The Puppet configuration is not shared between host and VM.
这篇关于Vagrant+Puppet puppet.module_path 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!