2016-11-18 45 views
0

我已经使用Vagrant在Oracle VirtualBox中设置了Puppet主/代理,并且根据the README中的说明在主代理和代理上安装了netdev_stdlibPuppet netdev_stdlib:如何解决“无效的资源类型netdev_device”?

我已经设置了模块路径/etc/puppet/modules/netdev_stdlib,其中标准库stdlib也存在。

主节点为puppet.example.com,代理为node01.example.com

我的清单文件如下:

node default { 
    file { "/tmp/example_ip": ensure => present } 

    include stdlib    # No error on this line 
    # include netdev_stdlib  # Uncomment this line will cause error 
    netdev_device { $hostname: } 
} 

然而,当我我得到了

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type netdev_device at /etc/puppet/manifests/site.pp:17 on node node01.example.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

客户端我试图在清单文件site.pp使用include netdev_stdlib上运行puppet agent -t,但木偶couldn找不到类netdev_stdlib。但是,include stdlib是好的。

+0

对不起,清单文件site.pp格式被搞砸了,我的观点是文件'/ tmp/example_ip'能够在主服务器和代理之间同步,所以文件很好,但是在添加netdev_device {$ hostname:}之后代理(或主服务器?)无法识别netdev_stdlib应该附带的资源“netdev_device”。 – luke

+0

你在使用舞台吗?否则'包括stdlib'是不必要的。 –

回答

1

I tried to use include netdev_stdlib in manifest file site.pp but Puppet couldn't find the class netdev_stdlib, but include stdlib is fine.

netdev_stdlib模块不提供类,它可以简单地包括在内。它更多的是编写新的Puppet类型来管理Ruby中的网络设备的编程框架。

您应该使用模块编写自己的新网络设备模块,以便通过自述文件接口到某种新类型的设备,或者删除它并不包括该类。

如果您尝试管理网络设备,则应该查找支持该类型设备的现有模块 - 然后可以将此模块用作依赖项。如果您没有管理网络设备,我认为您不应该尝试使用该模块。

请注意,大多数模块自述文件将指出可以包含的类名;并非所有的模块都会包含Puppet类。

0

小姐{在文件类型的端:

变化从:

file { "/tmp/example_ip": ensure => present, 

file { "/tmp/example_ip": ensure => present, } 
相关问题