即使存在文件,missing类也丢失

时间:2018-08-01 04:04:09

标签: puppet

木偶仓库的目录结构为:

.
|-- 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

1 个答案:

答案 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,以防万一。