Skip to content

Instantly share code, notes, and snippets.

@mkrakowitzer
Created April 9, 2014 14:25
Show Gist options
  • Save mkrakowitzer/10276574 to your computer and use it in GitHub Desktop.
Save mkrakowitzer/10276574 to your computer and use it in GitHub Desktop.
puppet facts for openssl version and build date
Facter.add(:openssl_version) do
confine :kernel => :linux
setcode do
family = Facter.value('osfamily')
case family
when "RedHat"
version = Facter::Util::Resolution.exec('/bin/rpm -q --queryformat "%{VERSION}-%{RELEASE}" openssl')
when "Debian"
version = Facter::Util::Resolution.exec('/usr/bin/dpkg-query -W -f=\'${Version}\' openssl')
else
nil
end
end
end
Facter.add(:openssl_built_on) do
confine :kernel => :linux
setcode do
version = Facter::Util::Resolution.exec('openssl version -b')
if version
version.to_s.gsub("built on: ", "")
else
nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment