Puppet:如何修复“无效的资源类型 file_line”?

Ita*_*not 1 puppet puppetmaster puppet-agent

我有一个新安装的 Puppet 服务器,只配置了一个模块和一个托管客户端。

这是一个 MOTD 模块,看起来像这样:

class motd {
    file { "/etc/custom_motd.sh":
    path    => '/etc/custom_motd.sh',
    ensure  => present,
    owner   => "root",
    group   => "root",
    mode    => "775",
    content => template('motd/custom_motd.sh.erb'),
    #require => Class['nagios_client'],
    }

#    file_line { 'enable motd':
#    ensure  => present,
#    line    => '/etc/custom_motd.sh',
#    path    => '/etc/profile',
#    require  => File['/etc/custom_motd.sh']
#    }
}
Run Code Online (Sandbox Code Playgroud)

当我puppet agent -t在客户端上运行时,我得到了正确的结果:

[root@pnd01 ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for pnd01.company.com
Info: Applying configuration version '1426413575'
Notice: /Stage[main]/Motd/File[/etc/custom_motd.sh]/ensure: created
Notice: Finished catalog run in 0.24 seconds
[root@pnd01 ~]#
Run Code Online (Sandbox Code Playgroud)

但是,如果我取消注释init.pp模块文件中的“文件行”部分,然后puppet agent -t在客户端上运行,则会得到以下响应:

[root@pnd01 ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type file_line at /etc/puppet/environments/production/modules/motd/manifests/init.pp:17 on node pnd01.company.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
[root@pnd01 ~]#
Run Code Online (Sandbox Code Playgroud)

第 17 行指向“file_line”声明。我在另一个 Puppet 环境中有完全相同的模块,它在那里工作得很有魅力。我在谷歌上查了一下,找到了一篇建议添加的帖子:

pluginsync = true
Run Code Online (Sandbox Code Playgroud)

到客户端机器上的[main]部分,/etc/puppet/puppet.conf我已经这样做了,但我仍然遇到同样的错误。

知道如何解决这个问题,或者为什么会发生?

Sve*_*ven 5

您可能需要安装标准库。在您的其他安装中,这可能是由您安装的其他模块引入的。

之后,将其与include stdlib.