I have a freshly installed Puppet server with only one module configured and one managed client.
This is a MOTD module and looks like so:
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']
# }
}
When I run puppet agent -t
on the client I get the proper result:
[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 ~]#
But if I uncomment the "file line" section in the init.pp
file of the module and then run puppet agent -t
on the client, I get the following response:
[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 ~]#
Line 17 points to the "file_line" declaration. I have the exact same module on another Puppet environment and it works there like a charm. I've looked it up on Google and found a post which recommends to add:
pluginsync = true
to the [main]
section of /etc/puppet/puppet.conf
on the client machine and I've done so but I still get the same error.
Any idea how to fix this issue or why does it even happen?