Please help me configuring custom puppet modules from github. The modules are pulled correctly in master but not getting recognized on the agent nodes at all.
Puppetfile
mod "puppet-lamp",
:git => "https://github.com/blablabla/puppet_lamp.git",
:ref => "659fe4056060426d3a1449sdfgbc290571f5714f"
environment.conf
modulepath = modules:$basemodulepath
r10k pulls the module from github correctly
.
└── production
├── environment.conf
├── modules
│ └── lamp
│ └── manifests
│ ├── apache.pp
│ └── test.pp
└── Puppetfile
4 directories, 4 files
apache.pp
class apache {
package { 'httpd':
ensure => installed,
}
service { 'httpd':
enable => true,
ensure => 'running'
}
}
site.pp
include apache
But when I run the agent, nothing gets applied!
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Applying configuration version '1549348460'
Notice: Applied catalog in 0.01 seconds
Tried using the node definition, no change...
node 'default' {
include 'apache'
}
Using latest puppet here
[root@puppetmaster environments]# puppetserver --version
puppetserver version: 6.2.0
[root@node01 ~]# puppet -V
6.2.0
Could someone please advise on what am I doing wrong? Thanks in advance!
Your class name must match the module name to obey autoloading restrictions. In your case, you have named the module lamp
, and you have named the class apache
. The easier route here would be to rename the class lamp
since it is referenced as lamp
everywhere else according to your question.
Another autoloading restriction is that your class name must match the module name and manifest name. In this case, your manifest is named apache.pp
, which means the class would then have to be lamp::apache
in both definition and declaration. The easier route here would be to rename the manifest from apache.pp
to init.pp
so that the class name would just have to match the module name.
Given both of these namespacing problems with your autoloading, the two steps that are easiest to get you working would be:
apache
in your manifests to lamp
(e.g. class lamp
and include lamp
).apache.pp
manifest to init.pp
.For further information, you can consult the Puppet documentation for the version of Puppet that you are using.