How to install a package if it is not installed using puppet conditions

0 votes
I need to install java in a pupper agent, where i need to use conditions if java is already installed or not in that server. If it is not installed, that has to be installed. Can you please help in this
Mar 17, 2020 in Puppet by Edureka
• 120 points

1 answer to this question.

+1 vote
You will need to write a puppet manifest that will check for these custom facts that you require ( whether java is installed or not). If java is installed, you need to specify it to install java on the agent depending on the underlying OS that you are using.

When you run puppet agent -t the agent node will pull these custom facts that are required and then depending on whether java is installed or not it will do the further required things.
answered Mar 18, 2020 by Sirajul
• 59,070 points

Thanks for your response. Can you pls give me an example, since i am a beginner.

Hey, since you are a beginner, I suggest you to have a look at this blog 

This will help you to write your own custom code snippet,

Related Questions In Puppet

0 votes
1 answer

Is it possible to install puppet agent in a docker container on linux?

Hey @Janice, this is pretty simple. Create ...READ MORE

answered Mar 12, 2019 in Puppet by Jason
0 votes
1 answer

How to install a package in the slave node with Puppet ?

Hi@akhtar, You need to add your node definition ...READ MORE

answered Dec 31, 2020 in Puppet by MD
• 95,220 points
0 votes
1 answer

Puppet+Docker: How do i configure a swarm if i am using windows server 2016.

There are a few considerations to be ...READ MORE

answered Aug 16, 2019 in Puppet by Sirajul
• 59,070 points
0 votes
1 answer

Puppet+Kubernetes: Is there a way to create resources in Kubernetes using Puppet?

Yes, it is quite possible to create ...READ MORE

answered Aug 23, 2019 in Puppet by Sirajul
• 59,070 points
+5 votes
2 answers

How To Deploy Windows Server Using Puppet?

Deploying windows server through Puppet is similar ...READ MORE

answered Mar 26, 2018 in Puppet by shubham
• 7,320 points
0 votes
1 answer

Puppet not recieving hiera data

Puppet does not consider the variables defined ...READ MORE

answered May 7, 2018 in Other DevOps Questions by ajs3033
• 7,280 points
0 votes
1 answer
+3 votes
4 answers

Chef vs puppet

Both chef and puppet have their own ...READ MORE

answered Aug 13, 2018 in Chef by Sahil
0 votes
0 answers