木偶仓库的目录结构为:
.
|-- data
| |-- common.yaml
|-- environment
| |-- environment.conf
| `-- hiera.yaml
|-- files
| `-- cdn
|-- hiera
| `-- hiera.yaml
|-- hiera.global.yaml
|-- manifests
| `-- site.pp
|-- modules
|
`-- site
|-- profile
| |-- files
| `-- manifests
| |-- appliance
| | |-- base.pp
`-- role
`-- manifests
|-- README.md
`-- role1
`-- appliance.pp
site.pp文件为:
File { backup => false }
if $::custom_facts['appliance_type'] == 'Delivery' {
include role::role0::app
}
if $::custom_facts['appliance_type'] == 'Appliance' {
include role::role1::appliance **// line where error is occuring**
}
node default {
}
当我运行puppet apply命令时,它失败并显示以下错误:
Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::role::role1::appliance for default-puppetmaster-centos-7.vagrantup.com (file: /tmp/kitchen/manifests/site.pp, line: 9, column: 3) on node default-puppetmaster-centos-7.vagrantup.com
应用的木偶命令:
sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp --modulepath=/tmp/kitchen/modules --fileserverconfig=/tmp/kitchen/fileserver.conf --environment=kitchen_vagrant_puppet --environmentpath=/etc/puppetlabs/code/environments --hiera_config=/tmp/kitchen/hiera.global.yaml
我不知道为什么木偶找不到班。该类在角色文件夹中。目录结构是否错误?
编辑:
添加envirnment.conf
文件的内容:
modulepath = site:modules:$basemodulepath
答案 0 :(得分:2)
这仅仅是因为modulepath需要包含site
吗?您的清单位于site
中,而不是modules
中。
sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp \
--modulepath=/tmp/kitchen/modules:/tmp/kitchen/site \
--fileserverconfig=/tmp/kitchen/fileserver.conf \
--environment=kitchen_vagrant_puppet \
--environmentpath=/etc/puppetlabs/code/environments \
--hiera_config=/tmp/kitchen/hiera.global.yaml
我也会在modulepath
中检查environment.conf
,以防万一。