1
I successfully installed the puppetlabs java module using command puppet module install puppetlabs-java
.
I created a puppet module using command puppet module generate ...
I have two manifest files init.pp
and java.pp
. Later i will have more.
init.pp
class mystuff {
anchor { 'mystuff::begin': }
-> class { 'mystuff::java': }
-> anchor { 'mystuff::end': }
}
java.pp
class mystuff::java(){
class { 'java':
package => 'java-1.8.0-openjdk-devel'
}
}
I then build the puppet module using command puppet module build
.
I then installed the module using command puppet module install ~/.../pkg/...-0.1.0.tar.gz
.
My idea was to test it with a new manifest file so i created a file called test-it.pp
.
test-it.pp
class { 'mystuff': }
I then called puppet apply ./test-it.pp
. And i get the following logo output:
Warning: /etc/puppetlabs/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
(in /etc/puppetlabs/puppet/hiera.yaml)
Notice: Compiled catalog for masternode.mydomain.com in environment production in 0.15 seconds
Notice: /Stage[main]/Java/Package[java]/ensure: created
Notice: /Stage[main]/Java::Config/File_line[java-home-environment]/ensure: created
Notice: Applied catalog in 7.72 seconds
But now when i go to my slave node and i type java
it says command not found
.
What did i do wrong?
Glad you found a solution and hope you have these cleared out by now. Puppet will perform changes only on the machine that you run the commands to. So running the
puppet apply
on the master would have applied the manifest to the master. Now thepuppet agent -t
is running all the modules/manifests that you have specified in the node definition on the puppet master. In your current config, you can have the manifest as you specified it underproduction/manifests
. (Continued) – Jimmy_A – 2019-09-05T16:01:58.203In general, it should not have mattered the name of the manifest
test-it.pp
orsite.pp
as long as you specify it in the node. Later on, when you addmodules
with their ownmanifests
you can name them whatever you like. E.gproduction/modules/tomcat/manifests/version_9.pp
. In the node definition, you will call it astomcat::version_9
. This is useful if you have multiple manifests/versions/installations. You can have one node calltomcat::version_9
and another nodetomcat::version_8
by adding a second manifest in the moduleproduction/modules/tomcat/manifests/version_8.pp
– Jimmy_A – 2019-09-05T16:05:45.680Your current config works because by default the node looks in
production/manifests/site.pp
. By adding modules though you can have separate manifests that do specific jobs, instead of putting them all in one. Furthermore, with a node definition, you can specify different environments and or variables for each machine. – Jimmy_A – 2019-09-05T16:12:29.577@Jimmy_A Thank you very much for the clarification. Before it was like: It is not working and i have no idea why, oh it is working but i have no idea why :) – arnonuem – 2019-09-06T18:35:51.013