Skip to content

Instantly share code, notes, and snippets.

View michaelrice's full-sized avatar

Michael Rice michaelrice

View GitHub Profile
@michaelrice
michaelrice / ResetAlarm.groovy
Last active August 29, 2015 14:01
Resets an alarm from red to green using the unexposed soap api in vsphere.
import com.budjb.requestbuilder.RequestBuilder
import com.rackspace.vmaintenance.hba.exception.RescanHbaException
import com.vmware.vim25.mo.HostSystem
import groovy.xml.StreamingMarkupBuilder
import groovy.xml.XmlUtil
import org.apache.log4j.Logger
/**
* Ported Michael Rice code from perl to Groovy
Vagrant::Config.run do |config|
config.vm.box = "esxi-test"
config.ssh.username = "root"
config.ssh.password = "password"
config.vm.network :bridged
end
.idea
*.iml
@michaelrice
michaelrice / nfs.groovy
Created July 28, 2014 17:35
mount NFS with groovy
HostDatastoreSystem hds = host.getHostDatastoreSystem()
HostNasVolumeSpec hnvs = new HostNasVolumeSpec()
hnvs.setRemoteHost(remoteHostIp)
hnvs.setRemotePath(remotePath)
hnvs.setLocalPath(localPath)
hnvs.setAccessMode(accessMode)
hds.createNasDatastore(hnvs)
@michaelrice
michaelrice / response.yaml
Created August 4, 2014 18:26
betamax recording from vijava
!tape
name: getVm_tape
interactions:
- recorded: 2014-08-03T02:14:17.955Z
request:
method: POST
uri: https://vs00-winutil.home.lab/sdk
headers:
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
private List clusterProperties = [
'name',
'parent',
'datastore',
'network',
"configuration.drsConfig.enabled",
"configuration.dasConfig.enabled"
]
@michaelrice
michaelrice / .gitconfig
Created August 5, 2014 01:01
My dot-gitconfig
[user]
email = [email protected]
name = Michael Rice
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
// Create the updated device spec
VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec()
nicSpec.device = nic
nicSpec.operation = VirtualDeviceConfigSpecOperation.edit
// Create the VM update spec
VirtualMachineConfigSpec spec = new VirtualMachineConfigSpec()
spec.deviceChange = [nicSpec]
// Do the update
@michaelrice
michaelrice / network_info.xml
Created August 8, 2014 20:27
your mom face
<network-info>
<value name="current-max-virtual-switches" type="uint32" format="dec">256</value>
<value name="next-reboot-max-virtual-switches" type="uint32" format="dec">256</value>
<console-nic-info>
<console-nics>
</console-nics>
</console-nic-info>
<routing-info>
<value name="kernel-gateway" type="string">10.13.88.193</value>
<value name="kernel-ipv6-gateway" type="string">::</value>
/**
* Adds host to vcenter.
*
* @param fqdn
* @param sslThumbprint
* @param password
* @return
* @throws Exception
*/
String addHostToVC(String fqdn, String sslThumbPrint, String pass) throws Exception {