I created a module named 'learn-tomcat' and it has a class named tomcat (in init.pp). When I try to include this class in a node definition, it does not work, all of following combination throw an error, the combinations are:
include learn-tomcat::tomcat
include learn-tomcat
include tomcat
include ::tomcat
And error is same with above combinations:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class
Now when I rename module directory learn-tomcat to tomcat, then following start working!
include tomcat
include ::tomcat
include tomcat::tomcat
Now I am confused about a few things:
Here you have a comprehensive explanation how namespaces and scopes works in puppet.
According to the example from the article:
name: file path:
apache <modulepath>/apache/manifests/init.pp
apache::mod <modulepath>/apache/manifests/mod.pp
apache::mod::passenger <modulepath>/apache/manifests/mod/passenger.pp
So in your situation you can also do one of the following suggestion:
In module learn-tomcat
in init.pp
, rename tomcat
class to learn-tomcat
, and than instance it by:
include learn-tomcat
Rename the file init.pp
to tomcat.pp
and than instance it by:
include learn-tomcat::tomcat