Amiramix Amiramix - 1 month ago 6
Apache Configuration Question

CFEngine - set variable if a specific package version is installed

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.

Answer

You could use packagesmatching to get the version of httpd that's currently installed. You might combine it with ifelse, strcmp, regcmp so that you can set different variables and classes which you might use in your template.