Puppet - 无法找到声明的类

时间:2016-04-24 18:24:53

标签: vagrant puppet

我试图在puppet中使用类。我有以下设置:

  • 清单/
    • default.pp
    • web.pp

我试图在default.pp中调用类web:

class { 'web': }

我收到了以下错误:

"Error: Could not find class web for ubuntu-14.localdomain on node ubuntu-14.localdomain"

我做错了什么?

该类在web.pp中声明如下:

class web {
   package {'apache2':
          ensure => 'installed',
  }
}

我还尝试将该类称为:include web

1 个答案:

答案 0 :(得分:1)

您应该将Web类作为新模块移动

puppet
├── _manifest
|   └── default.pp
├── _modules
|   ├── _web
|   |   └── _manifests
|   |       └── init.pp

只需将文件web.pp重命名为web/manifest/init.pp

即可

default.pp中确保包含您的模块:

class { 'web': }
include web

PS:确保从vagrant配置中引用您的模块目录

相关问题