Can I use wildcards is puppet package ensure to cover multiple releaseversion
Solution 1:
You would have to set a variable with a case statement, sort of like this:
class puppet::installation inherits puppet {
case $::operatingsystemrelease {
'5': { $puppet_ver = '3.0.1-1'}
default: { $puppet_ver = '3.0.1-1.el6'}
}
package { 'puppet':
ensure => $puppet_ver,
}
}
However, it's a better design to use a params.pp file for this sort of logic. Read about params.pp here: http://www.example42.com/?q=understandExample42PuppetModules
Solution 2:
Puppet really doesn't have any functionality for this yet (though they really need it).
You can use the yum-versionlock
yum plugin to lock specific RPM packages at specific versions, and then use puppet to control the versionlock configuration.
For some other workarounds, see this related question.
Solution 3:
Actually, I was able to use the wildcard character to install a specific version of Python regardless of operating system. My package code for python is as follows.
package {
"python-dev": ensure => "2.7.3*";
"python-setuptools": ensure => installed;
"python-pip": ensure => installed;
"libxml2-dev": ensure => installed;
"libxslt-dev": ensure => installed;
}
By using the 2.7.3* as the ensure version, it installed python 2.7.3-0ubuntu2.2 on my vagrant VM. I'm using Puppet version 2.7.19.