Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created August 21, 2014 17:48
Show Gist options
  • Save michaelrice/0e83c59bd46eb85aa56c to your computer and use it in GitHub Desktop.
Save michaelrice/0e83c59bd46eb85aa56c to your computer and use it in GitHub Desktop.
/**
* Adds host to vcenter.
*
* @param fqdn
* @param sslThumbprint
* @param password
* @return
* @throws Exception
*/
String addHostToVC(String fqdn, String sslThumbPrint, String pass) throws Exception {
log.trace("Adding host to VC")
HostConnectSpec hcSpec = new HostConnectSpec()
hcSpec.with{
hostName = fqdn
sslThumbprint = sslThumbPrint
userName = "root"
password = pass
}
Task task = getHostFolder().addStandaloneHost_Task(hcSpec, null, true, getHostLicense())
String res = task.waitForMe()
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment