Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active December 1, 2017 18:56
Show Gist options
  • Save binford2k/53ce944e73b2e633c1148a77ff6c3e60 to your computer and use it in GitHub Desktop.
Save binford2k/53ce944e73b2e633c1148a77ff6c3e60 to your computer and use it in GitHub Desktop.
$versions = ['5.3.3', '4.9.0', '2.7.4', '3.6.2', '3.8.5' ]
# ...
if $versions {
$_versions = $versions.sort.reverse.join(', ')
$_packages = $versions.map |$version| {
"puppet:${version}"
}.join(' ')
exec { "gem install ${_packages} --bindir /tmp --no-document":
path => '/usr/local/bin:/usr/bin:/bin:/opt/puppetlabs/bin',
unless => "[[ \"$(gem list ^puppet$ | tail -1)\" == \"puppet (${_versions})\" ]]",
provider => shell,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment