Skip to content

Instantly share code, notes, and snippets.

@btm
Created January 28, 2009 02:16
Show Gist options
  • Save btm/53776 to your computer and use it in GitHub Desktop.
Save btm/53776 to your computer and use it in GitHub Desktop.
# get vmware host servername via guestinfo (provided we've already set it) and create an attribute
require 'facter'
if File.file?("/usr/sbin/vmware-guestd")
vmwarehost = IO.popen("/usr/sbin/vmware-guestd --cmd 'info-get guestinfo.host'") { |io| io.gets }
if vmwarehost
replace_attrib("vmwarehost", vmwarehost.chomp)
end
end
# add tag if we detect that we're vmware guest
if Facter.value(:productname) == "VMware Virtual Platform"
add_tag("vmware-guest")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment