这可能只是一个基本问题,但我找不到解决方案。我建立了一个我想使用puppetlabs提供的apache模块的环境。
我的木偶版本3.7.2
树我的目录:木偶无法从已安装的模块apache找到类
.
├── environments
│ └── test
│ ├── environment.conf
│ ├── manifests
│ │ └── site.pp
│ └── modules
│ ├── apache
│ │ └── manifests
│ │ ├── init.pp
│ │ └── vhost_basic.pp
│ └── update
│ └── manifests
│ └── init.pp
└── Vagrantfile
我里面Vagrantfile供应者是这样的:
config.vm.provision :puppet do |puppet|
puppet.environment_path = "environments"
puppet.environment = "test"
puppet.options = ['--verbose']
end
我site.pp:
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
include update
node 'localhost' {
class { 'apache': } # use apache module
apache::vhost { 'example.com': # define vhost resource
port => '80',
docroot => '/var/www/html'
}
}
里面的apaches(目录)init.pp我只有include apache
。我通过puppet module install puppetlabs-apache
安装了Apache模块。它也存储在home/user/.puppet/modules
。我也通过sudo安装了这个模块(因为我在某处读了它有所不同)。但是当我运行vagrant provision
它说我:
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment test...
==> default: Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class apache at /tmp/vagrant-puppet/environments/test/manifests/site.pp:16:3 on node localhost
我在这里错过了什么?
编辑:
的puppet config print |grep path
的结果是:
path = none
environmentpath =
basemodulepath = /home/user/.puppet/modules:/usr/share/puppet/modules
modulepath = /home/user/.puppet/modules:/usr/share/puppet/modules
factpath = /home/user/.puppet/var/lib/facter:/home/user/.puppet/var/facts
在Vagrantfile您的机器上设置的 “localhost” 的主机名? – k0chan
你的'environment.conf'中的'modulepath'有哪些值? –
@ k0chan不是它没有设置,但添加'config.vm.hostname =“localhost”'给出了相同的结果 – user3528269