Skip to content

Instantly share code, notes, and snippets.

@robbyt
Created February 24, 2012 19:38
Show Gist options
  • Save robbyt/1903206 to your computer and use it in GitHub Desktop.
Save robbyt/1903206 to your computer and use it in GitHub Desktop.
centrify fact for puppet
if File.exist?("/usr/bin/adinfo")
%x{/usr/bin/adinfo}.each do |line|
if line =~ /^(.+):(\s+)(.+)$/
var = $1; val =$3
# this will add centrify_ to each facter key, and
# replace spaces in the keys with _'s, and dropcase
Facter.add("centrify_" + var.gsub(/\s+/, "_").downcase()) do
setcode { val.chomp() }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment