module-nginx/lib/facter/nginx_version.rb
2016-02-05 18:11:15 +11:00

8 lines
244 B
Ruby

Facter.add(:nginx_version) do
setcode do
if Facter::Util::Resolution.which('nginx')
nginx_version = Facter::Util::Resolution.exec('nginx -v 2>&1')
%r{^nginx version: nginx\/([\w\.]+)}.match(nginx_version)[1]
end
end
end