Recently I’ve been working on improving HobbitCloud’s DevOps practices, specifically around committing code to version control and documenting it. Once a developer checks code in, this should compile, and if successful be deployed to the test environment. Once here it will undergo automated testing before progressing to staging for unit and integration tests. Continue reading
scripting
Using vCloud Air to stand-up a Chef Compliance Proof-of-Concept
The other day I wanted to start playing with Chef, as it’s a tool our company is about to use a lot, and it’s one area I’m quite behind the curve on. Unfortunately the lab was maxed out for resources, so I decided to turn to vCloud Air to rapidly provision an environment. Continue reading
Wednesday Tidbit: Who turned off Admission Control?
After my post on measuring and preventing vSphere resource over-commitment, a discussion arose at the company I work regarding HA admission control. It would appear that it has been disabled on a number of internal Continue reading
Measuring and preventing vSphere resource over-commitment
Recently I was asked to perform a VMware environment review for a financial services customer of ours. This involved reviewing a number of settings across the estate, one of which being resource utilisation. The biggest challenge was to ensure that none of the customer’s clusters were Continue reading
Wednesday Tidbit: Create an alert for ESXi host profile deviation
In vCenter, I’ve always found it strange that by default if an ESXi host deviates from its host profile, then the only notification an administrator would receive is a red cross in the GUI. I don’t know about you, but we regard that as a serious issue, as any deviation could lead to unplanned downtime. Continue reading
Wednesday Tidbit: registering multiple vCenters with vCOPs
Recently, the company I work for has done really well in bringing onboard new customers – nearly all of which we have provided with a private cloud solution running on the VMware platform. Continue reading
Wednesday Tidbit: Shutdown your lab with one click
Recently I’ve found myself having to shutdown my home lab quite often as the weather has been better than expected and the temperature has risen dramatically. Great for sitting in beer gardens, not so good for the lab.
To speed up the process of shutting down all my VMs (currently 68 of them) I decided to knock up a very simple PowerCLI script:
# Variables $esxi = "esxi.mdb-lab.com" $credential = Get-Credential Connect-VIServer $esxi -Credential $credential Get-VM | where {$_.Powerstate -eq "PoweredOn"} | Shutdown-VMGuest -Confirm:$false Start-Sleep -s 600 Stop-VMHost -Confirm:$false -Force:$true Disconnect-VIserver $esxi -Confirm:$false
Definitely not rocket science, but the greatest scripts don’t always have to be complicated.
There are a lot of other devices (storage and networking equipment) that also have to be scripted to shutdown, but this is a start.
Wednesday Tidbit: Create custom ESXi ISO with ESX-tools-for-ESXi
My test cluster in the lab recently needed to be rebuilt. As this cluster is nested and I wanted the latest version of ESXi to be deployed, I thought it would be good to use Image Builder to combine the two.
After downloading the VMware Tools for Nexted ESXi tools fling, I followed Andreas Peetz’ article on how to use them to build an offline bundle.
Once done, I used the following PowerCLI script with Image Builder to create my new ISO complete with VMware Tools for Nested ESXi:
# Add VMware depot Add-EsxSoftwareDepot C:\Depot\ESXi550-201505002.zip # Clone the ESXi 5.5 GA profile into a custom profile $CloneProfile = Get-EsxImageProfile ESXi-5.5.0-20150504001-standard $MyProfile = New-EsxImageProfile -CloneProfile $CloneProfile -Vendor $CloneProfile.Vendor -Name (($CloneProfile.Name) + "-virtualhobbit") -Description $CloneProfile.Description # Add the Nested ESXi VMTools Offline bundle Add-EsxSoftwareDepot C:\Depot\esx-tools-for-esxi-9.7.1-0.0.00000-offline_bundle.zip # Add the esx-tools-for-esxi package to the custom profile Add-EsxSoftwarePackage -SoftwarePackage esx-tools-for-esxi -ImageProfile $MyProfile # Disable signature check $DeployNoSignatureCheck=$true # Export the custom profile into an ISO file Export-EsxImageProfile -ImageProfile $MyProfile -ExportToISO -NoSignatureCheck -FilePath C:\Depot\ESXi550-201505002-virtualhobbit.iso
I also chose to export the image profile to a .zip file, so I could use it to remediate an existing cluster using VUM.
Export-EsxImageProfile -ImageProfile $MyProfile -ExportToBundle -NoSignatureCheck -FilePath C:\Depot\ESXi550-201505002-virtualhobbit.zip
Wednesday Tidbit: PowerCLI script to enable copy & paste
Unlike at work, when I access servers in the lab I use the vSphere Client remote console. Unfortunately since vSphere 4.1, copy & paste between the host and the console has been disabled – which I find a pain (even though it’s probably more secure). It can be enabled per-VM with the following two settings:
isolation.tools.copy.disable="false" isolation.tools.paste.disable="false"
I wanted to enable it on all my backend VMs, but not my other VMs (DMZ etc). For this I used the following PowerCLI script:
$esxi = "lab01.mdb-lab.com" $credential = Get-Credential $tgtVLAN = 'VLAN70','VLAN80','VLAN120' Connect-VIServer $esxi -Credential $credential Get-VM |where { (Get-NetworkAdapter -VM $_ | %{$tgtVLAN -contains $_.NetworkName}) -contains $true} | %{ New-AdvancedSetting $_ -Name isolation.tools.copy.disable -Value false -Confirm:$false -Force:$true New-AdvancedSetting $_ -Name isolation.tools.paste.disable -Value false -Confirm:$false -Force:$true } } Disconnect-VIServer $esxi -Confirm:$false
I’d like to thank Luc Dekens for helping me with that last bit. If you get chance, check him out at http://www.lucd.info/.