我正在尝试从 puppet list 中的本地模块获取文件(在独立模式下使用 puppet):
file {
'/home/repowt/.crontab':
ensure => present,
source => 'puppet:///modules/site/crontab';
}
但我得到:
Could not evaluate: Could not retrieve information from source(s) ...
该文件位于:
config/puppet/modules/site/files/crontab
(通过
vagrant provision
调用 puppet 并且 Vagrantfile 指定 module_path='config/puppet/modules' 并且显然没问题,因为 puppet 确实从那里加载模块。)我也试过:
source => 'puppet:///site/crontab'
source => 'site/crontab'
source => 'config/puppet/modules/site/files/crontab'
source => '/modules/site/crontab'
无济于事。我在网上找不到任何启发性的东西,似乎很简单。
感谢您的帮助。
最佳答案
这里发生了几件事。
首先,正如 pwan 所说,fileserver.conf
需要正确设置。
请记住 /vagrant
包含 Vagrantfile
所在的目录是(因此所有内容),这对我来说意味着:
vm_config.vm.provision :puppet, :module_path => "modules", :options => ["--fileserverconfig=/vagrant/fileserver.conf", ]
我的
fileserver.conf
指定 /etc/puppet/files
是要使用的。虽然我可以指定一个不同的
fileserver.conf
,就 Vagrant 而言,我希望几乎所有东西都和平常一样。所以,我也安装了
/etc/puppet/files
也,与vm_config.vm.share_folder "files", "/etc/puppet/files", "files"
这让事情对我有用。
关于ruby-on-rails - 如何从模块中获取 puppet list 中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7216375/