How do I set variable if a specific package version is installed in CFEngine?

0 votes
A script needs to support two servers, Fedora and Centos, with different versions of httpd (Apache). CFEngine is used to create the configuration file and it needs to put different sections to the file depending on which httpd version is installed in the system. How can I set a variable to true/false depending on which version is installed so that I can then generate the file appropriately?

All the examples I could find only deal with installing, upgrading or removing packages.

Can anyone help me with this?

Thanks.
Jul 12, 2018 in Other DevOps Questions by Damon Salvatore
• 5,510 points
101 views

1 answer to this question.

0 votes

Here is what you can do.Just use packagesmatching to get the version of httpd that's currently installed. You might combine it with ifelsestrcmpregcmp so that you can set different variables and classes which you might use in your template.

I hope the above information will be helpful for you.

answered Jul 12, 2018 by Atul
• 10,240 points

Related Questions In Other DevOps Questions

0 votes
1 answer

How do I share Build Definitions across Projects in Visual Studio Online?

VSTS does not support sharing build definitions ...READ MORE

answered Jul 5, 2018 in Other DevOps Questions by DareDev
• 6,810 points
37 views
0 votes
1 answer

how do i make apache2 site point outside the folder in ubuntu?

in apche2 configuration file u have to ...READ MORE

answered Jul 6, 2018 in Other DevOps Questions by Kalgi
• 45,830 points
42 views
0 votes
1 answer

How to get issues count based on rules in a sonar project?

There are API docs in the footer ...READ MORE

answered May 4, 2018 in Other DevOps Questions by DareDev
• 6,810 points
494 views
0 votes
1 answer

SaltStack: how do I repeat other states with context?

In your case it’ll look something like ...READ MORE

answered Jul 10, 2018 in Other DevOps Questions by Kalgi
• 2,620 points
73 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How do I preserve local ivy repository in Bluemix BUILD & DEPLOY?

You're right--the pipeline spins up a new ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by Atul
• 10,240 points
42 views
0 votes
1 answer

How do I manage stranded resources in Chef?

Try the follow the follow this procedure. ...READ MORE

answered Jul 23, 2018 in Other DevOps Questions by Atul
• 10,240 points
45 views