http://www.rayheffer.com/1132/vmware-vcap-dca-study-resources/#more-1132
http://damiankarlson.com/vcap-dca4-exam/
http://kendrickcoleman.com/index.php?/Tech-Blog/vcap-datacenter-administration-exam-landing-page-vdca410.html
http://www.vmwarevideos.com/vcap
Tuesday, September 27, 2011
Thursday, September 15, 2011
Batch file to identify missing computers when they come back online
We have an estate of approximately 2000 laptops , these would sometimes go missing for whatever reason...
they could be under a developers desk , they may have been put in a cupboard and forgotten about or given to a user who took the machine home and "forgot" about it , i decided to create a simple batch file that would ping a list of computer names and when it received a reply send a mail to a user or a distribution list , here is the content of the batch file.
(obvously blat is required for this)
echo off
for /f "tokens=1" %%d in (computerlist.txt) Do Call :Pingthelost %%d
:pingthelost
set state=found
ping -n 1 %1
if errorlevel 1 set state=dead
echo %1 is %state%
If %state%==found call "c:\windows\system32\blat.exe" "c:\null.txt" -t Darragh.mcavinue@work.com -s "%1 is a missing computer which has appeared on the network"
simple !
UPDATE
we had what looked like a few false positives , the assets manager said that although he was beinga lerted that some computers were appearing on the network he was still unable to reach them.
I pinged one of the suspected false positives and got a reply from the router with a TTL expired , any computer that was on our remote access subnet that was being pinged was generating this error , this i suspect was the firewall policy for any of the machines on this subnet.
they could be under a developers desk , they may have been put in a cupboard and forgotten about or given to a user who took the machine home and "forgot" about it , i decided to create a simple batch file that would ping a list of computer names and when it received a reply send a mail to a user or a distribution list , here is the content of the batch file.
(obvously blat is required for this)
echo off
for /f "tokens=1" %%d in (computerlist.txt) Do Call :Pingthelost %%d
:pingthelost
set state=found
ping -n 1 %1
if errorlevel 1 set state=dead
echo %1 is %state%
If %state%==found call "c:\windows\system32\blat.exe" "c:\null.txt" -t Darragh.mcavinue@work.com -s "%1 is a missing computer which has appeared on the network"
simple !
UPDATE
we had what looked like a few false positives , the assets manager said that although he was beinga lerted that some computers were appearing on the network he was still unable to reach them.
I pinged one of the suspected false positives and got a reply from the router with a TTL expired , any computer that was on our remote access subnet that was being pinged was generating this error , this i suspect was the firewall policy for any of the machines on this subnet.
Wednesday, September 14, 2011
Beep ping batch file
This is a very simple batch file whch will alert you if a system is up or down based on values passed to it by playing a sound in windows media player , i created it because a colleague was telling me that his mac book did this by default , and it seemed like a handy tool if you were waiting for a server to go down or come up.
i called the batch file bping.bat and this is an example of a command line to run the tool.
I also added the option to put an interpackket delay in so that i could use it to test for high latency wan link packets being dropped
bping.bat 192.168.100.100 1000 up
This will ping 192.168.100.100 with a inter packet delay of 1000 milliseconds and will play a sound when the device responds to ping.
Echo off
CLS
Echo you are pinging %1 with a delay of %2 milliseconds between pings
echo and will be notified if packets are %3
Pause
CLS
If %3 == up Goto :Pingup
If %3 == Down Goto :Pingdown
:PingUP
PING %1 -n 1 | FIND "TTL=" >NULL
set pingresult=%errorlevel%
Echo on
PING %1 -n 1
Echo off
sleep -m %2
IF %pingresult% EQU 1 Goto :PingUP
Start "C:\program Files\Combined Community Codec Pack\MPC\Mplayer.exe /Play /Close" "C:\windows\Media\Notify.wav"
Goto PingUP
:PingDown
PING %1 -n 1 | FIND "TTL=" >NULL
set pingresult=%errorlevel%
Echo on
PING %1 -n 1
Echo off
sleep -m %2
IF %pingresult% EQU 0 Goto :PingDown
Start "C:\program Files\Combined Community Codec Pack\MPC\Mplayer.exe /Play /Close" "C:\windows\Media\Windows Exclamation.wav"
Goto PingDown
i called the batch file bping.bat and this is an example of a command line to run the tool.
I also added the option to put an interpackket delay in so that i could use it to test for high latency wan link packets being dropped
bping.bat 192.168.100.100 1000 up
This will ping 192.168.100.100 with a inter packet delay of 1000 milliseconds and will play a sound when the device responds to ping.
Echo off
CLS
Echo you are pinging %1 with a delay of %2 milliseconds between pings
echo and will be notified if packets are %3
Pause
CLS
If %3 == up Goto :Pingup
If %3 == Down Goto :Pingdown
:PingUP
PING %1 -n 1 | FIND "TTL=" >NULL
set pingresult=%errorlevel%
Echo on
PING %1 -n 1
Echo off
sleep -m %2
IF %pingresult% EQU 1 Goto :PingUP
Start "C:\program Files\Combined Community Codec Pack\MPC\Mplayer.exe /Play /Close" "C:\windows\Media\Notify.wav"
Goto PingUP
:PingDown
PING %1 -n 1 | FIND "TTL=" >NULL
set pingresult=%errorlevel%
Echo on
PING %1 -n 1
Echo off
sleep -m %2
IF %pingresult% EQU 0 Goto :PingDown
Start "C:\program Files\Combined Community Codec Pack\MPC\Mplayer.exe /Play /Close" "C:\windows\Media\Windows Exclamation.wav"
Goto PingDown
Thursday, September 1, 2011
V2P - for when you need to make the virtual - physical
Virtual to physical
Ref http://www.vmware.com/support/v2p/doc/V2P_TechNote.pdf (This has been tested on W2K3 SP1Enterprise edition with 2 partitions )
Requirements:
HP Smartstart CD
HP PSP
Sysprep (http://download.microsoft.com/download/a/2/6/a267c18e-32d7-4e59-81e7-816c3b23cc29/WindowsServer2003-KB892778-SP1-DeployTools-x86-ENU.cab)
Acronis “Tru Image” (IEDUBESXHMLUNSW/Acronisboot/boot.iso)
Storage Drivers for the RAID controller card on the target physical drive
Sufficient storage to capture an image of the Virtual machine
• Ensure the server is available on the network
• Boot the server using acronis tru image Boot into Acronis tru image enterprise server
• Remove the VMware tools Add/remove programs – remove VMWare tools
Under the “additional Commands” enter the following command “c:\sysprep\sysprep –clean” next → Finish → OK
• Add a new path to the storage driver locations Open HKLM\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion add the following value to the Devicepath entry “;%systemdrive%\drivers\storage
• Modify the c:\sysprep\Sysprep.inf file to include the storage drivers Open the sysprep.inf file add the following section to the bottom of the file
[SysprepMassStorage]
PCI\VEN_103C&DEV_3230&SUBSYS_3234103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
PCI\VEN_103C&DEV_3230&SUBSYS_3235103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
this config is applicable only if the destination system has a P400 RAID controller, if the system has a different controller you will obviously have to replace the hardware hardware ID and the driver name save the sysprep.inf file
P410i Controller uses the same driver set but requires the following line to be added to the bottom
of the sysprep.inf file
[SysprepMassStorage]
PCI\VEN_103c&DEV_323A&SUBSYS_3245103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
5300 / 6400 controllers use the following config in the sysprep.inf file (obviously using the relevant 5300/6400 drivers)
[SysprepMassStorage]
PCI\VEN_0E11&DEV_B060 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
PCI\VEN_0E11&DEV_B178 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
PCI\VEN_0E11&DEV_0046 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
(if you haven’t done it already – Take a snapshot) Open a command prompt on the physical machine and run the following command c:\sysprep\sysprep -pnp –forceshutdown OK → “reseal” → OK
Browse to the location were you captured the image to
Click next , “restore disks or partitions” Select one disk at a time , putting each disk on the corresponding physical storage , If there is more than 1 disk , then you need to slect “yes , i want to….” at the end of the first disk import, repeat until all disks are selected and imported. Next → next → proceed
Remove the CD and boot up the server , follow the installation procedure (although the server is supposed to join the domain , it will most likely fail as the correct drivers will not be installed) Once the server has booted up , run the latest PSP and install the drivers Reboot , join the domain Reserve IP in DHCP and Statically Assign
Ref http://www.vmware.com/support/v2p/doc/V2P_TechNote.pdf (This has been tested on W2K3 SP1Enterprise edition with 2 partitions )
Requirements:
HP Smartstart CD
HP PSP
Sysprep (http://download.microsoft.com/download/a/2/6/a267c18e-32d7-4e59-81e7-816c3b23cc29/WindowsServer2003-KB892778-SP1-DeployTools-x86-ENU.cab)
Acronis “Tru Image” (IEDUBESXHMLUNSW/Acronisboot/boot.iso)
Storage Drivers for the RAID controller card on the target physical drive
Sufficient storage to capture an image of the Virtual machine
Step 1 – Preparing the target physical machine
• Create target partitions to match the virtual machine Boot from Smartstart and create identically sized partitions To the source virtual machine.• Ensure the server is available on the network
• Boot the server using acronis tru image Boot into Acronis tru image enterprise server
Step 2 – preparing the virtual machine
(take a VM snapshot before proceeding) • Create a directory on the C drive called c:\drivers\storage Copy the extracted storage drivers to this directory • Create a directory on the C drive called c:\Sysprep Extract the sysprep files to this directory• Remove the VMware tools Add/remove programs – remove VMWare tools
Step 3 – Performing a sysprep
• Run c:\sysprep\setupmgr “Create new” → “sysprep Setup” → Select relevant OS→ “Yes , ….” Enter the correct info in the following … enter Product keyUnder the “additional Commands” enter the following command “c:\sysprep\sysprep –clean” next → Finish → OK
• Add a new path to the storage driver locations Open HKLM\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion add the following value to the Devicepath entry “;%systemdrive%\drivers\storage
• Modify the c:\sysprep\Sysprep.inf file to include the storage drivers Open the sysprep.inf file add the following section to the bottom of the file
[SysprepMassStorage]
PCI\VEN_103C&DEV_3230&SUBSYS_3234103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
PCI\VEN_103C&DEV_3230&SUBSYS_3235103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
this config is applicable only if the destination system has a P400 RAID controller, if the system has a different controller you will obviously have to replace the hardware hardware ID and the driver name save the sysprep.inf file
P410i Controller uses the same driver set but requires the following line to be added to the bottom
of the sysprep.inf file
[SysprepMassStorage]
PCI\VEN_103c&DEV_323A&SUBSYS_3245103C = “c:\drivers\storage\hpcissx2.inf”,”\”Smart Array SAS/SATA Windows Driver Diskette”, “txtsetup.oem”
5300 / 6400 controllers use the following config in the sysprep.inf file (obviously using the relevant 5300/6400 drivers)
[SysprepMassStorage]
PCI\VEN_0E11&DEV_B060 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
PCI\VEN_0E11&DEV_B178 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
PCI\VEN_0E11&DEV_0046 = “C:\Drivers\Storage\cpqcissm.inf”, “\”, “Smart Array 5x and 6x Driver Diskette”, “\TXTSETUP.OEM”
(if you haven’t done it already – Take a snapshot) Open a command prompt on the physical machine and run the following command c:\sysprep\sysprep -pnp –forceshutdown OK → “reseal” → OK
Step 4 – Moving the image
Once sysprep has done its magic and the VM is powered down we need to take an image using acronis.- Edit the VM settings to point the CD drive to IEDUBESXHMLUNSW/Acronisboot/boot.iso (make sure that the device is set to “connect at power on”
- Also in the VM settings , click the “options” tab , “Boot options” and set the delay to 10000 ms
- Power on the Virtual machine from within the console (you need to see the VM boot up sequence because you have to force it to boot from CD)
- In the Acronis startup manager – select “acronis true image echo enterprise server (full Version)”
- Once the application has started up , select “backup” “My Computer” select all of the available disks and click “next”, Do not Exclude anything
- Select the network location where you want to save the image (e.g \\iedubsrv56\servername$\servername.tib)
- Next → next → next → proceed
Step 5 – deploying the image to the physical machine
Assuming step1 has been completed , select RecoveryBrowse to the location were you captured the image to
Click next , “restore disks or partitions” Select one disk at a time , putting each disk on the corresponding physical storage , If there is more than 1 disk , then you need to slect “yes , i want to….” at the end of the first disk import, repeat until all disks are selected and imported. Next → next → proceed
Remove the CD and boot up the server , follow the installation procedure (although the server is supposed to join the domain , it will most likely fail as the correct drivers will not be installed) Once the server has booted up , run the latest PSP and install the drivers Reboot , join the domain Reserve IP in DHCP and Statically Assign
ESX41i Scripted deployment
ESX41i deployment
Useful Pages
http://www.van-lieshout.com/2009/10/uda2-0-test-drive/
http://www.rtfm-ed.co.uk/docs/vmwdocs/uda20-beta.pdf
http://www.virtuallyghetto.com/2010/09/automating-esxi-41-kickstart-tips.html
http://www.kendrickcoleman.com/index.php?/Tech-Blog/esxi-41-kickstart-install-wip.html
Useful Pages
http://www.van-lieshout.com/2009/10/uda2-0-test-drive/
http://www.rtfm-ed.co.uk/docs/vmwdocs/uda20-beta.pdf
http://www.virtuallyghetto.com/2010/09/automating-esxi-41-kickstart-tips.html
http://www.kendrickcoleman.com/index.php?/Tech-Blog/esxi-41-kickstart-install-wip.html
PXE deployment of ESX41i to hosts,
Although there are only 24 ESX hosts in the firm and deploying them manually would not be a
significant undertaking as the install per machine would be approx 30 minutes , the benefits ,
in our case to doing the deployment via a scripted PXE install are :
Identical repeatable builds - Apply known good working configurations
easily cope with hardware failures - failed array controller , CPU's etc , swap out the blade or server and kick off install
Perform upgrades of the OS by rolling out new install rather than patching -point PXE server to new OS and deploy our ESX servers have been gradually diverging in terms of configuration , this would be an ideal way to homogenize the builds
I downloaded and configured a copy of the Ultimate deployment appliance from
http://www.ultimatedeployment.org/
Deployed this to a VM , within the low resource usage pool , started it up and configured
the appliance , give it an IP address , hostname etc etc disabling DHCP as i did not want
the appliance handing out IPs on the server VLAN.
Once the machine was deployed the rest of the configuration was handled over the web based interface,
from vSphere i presented the ESX41i iso over the CD drive and from web interface of the UDA i mounted the CD drive.
Then click the OS tab and click new: enter the following
Flavor Name : ESX41i
operating system : VMware ESX...... click next
browse to the image location and click finish.
This imports the deployment image source files to the UDA
Now the UDA has the OS source files and is ready to hand out the base image, indeed we could
use the UDA as a store for unconfigured images in this state.
As we want to automate the deployment there are a number of things we need to do
we also need to secure and allow the windows DHCP servers to hand out the PXE host IP and the image name.
i will be allowing all servers on the server VLAN to potentially start up and unconditionally format and deploy ESX i have set the Appliance to request a password , this is to prevent accidental deployment of ESX41 to windows boxes.
To deploy the configured image successfully i need to customise it for our infrastructure , this requires
a kickstart script which contains settings for amongst others the source for the deployment media, the root password
disk partitioning , networking configuration , port groups , vmotion portgroup etc etc
( Some of the following code is plagiarised , specifically the joining AD part)
Within the templates tab , select advanced and paste the kickstart script in here
# Location script
# Standard install arguments
vmaccepteula
rootpw password
install url http:[UDA_IPADDR]/esx41i/ESX41i/
autopart --firstdisk --overwritevmfs
network --bootproto=static --device=vmnic0 --ip=[IPADDR] --gateway=10.128.134.229 --nameserver=10.128.100.100 --netmask=255.255.255.0 --hostname=[HOSTNAME].domainname.com --addvmportgroup=0
# We will configure some basic things during the first boot from the commandline before we add the host to vCenter
%firstboot --unsupported --interpreter=busybox
# Add an extra nic to vSwitch0 and a VLAN ID
esxcfg-vswitch -L vmnic1 vSwitch0
esxcfg-vswitch -v 26 -p 'Service Console' vSwitch0
# Add Server LAN and Deployment LAN portgroups to vSwitch 0
esxcfg-vswitch -A ''Server LAN' vSwitch0
esxcfg-vswitch -v 0 -p ''Server LAN' vSwitch0
esxcfg-vswitch -A ''win7 Deployment SP' vSwitch0
esxcfg-vswitch -v 29 -p 'win7 Deployment SP' vSwitch0
# Add new vSwitch for VM traffic (vmnic2 and vmnic3)
esxcfg-vswitch -a vSwitch1
# Add NICs to the new vSwitch1
esxcfg-vswitch -L vmnic2 vSwitch1
esxcfg-vswitch -L vmnic3 vSwitch1
# Add iSCSI Service Console and vmotion portgroups to vSwitch 1
esxcfg-vswitch -A 'iSCSI Service Console' vSwitch1
esxcfg-vswitch -v 27 -p 'iSCSI Service Console' vSwitch1
# Assign an ip-adress to the vMotion VMkernel and a VLAN ID to the Portgroup
esxcfg-vmknic -a -i [iSCSIsVCiP] -n 255.255.255.0 'iSCSI Service Console'
# Add 'RDM Switch' port group to vSwitch 1
esxcfg-vswitch -A 'RDM Switch' vSwitch1
esxcfg-vswitch -v 27 -p 'RDM Switch' vSwitch1
esxcfg-vswitch -A 'iSCSI-Vmotion' vSwitch1
esxcfg-vswitch -v 27 -p 'iSCSI-Vmotion' vSwitch1
# Assign an ip-adress to the vMotion VMkernel and a VLAN ID to the Portgroup
esxcfg-vmknic -a -i [vMotioniSCSIiP] -n 255.255.255.0 'iSCSI-Vmotion'
# Enable vMotion on the newly created VMkernel vmk0
vim-cmd hostsvc/vmotion/vnic_set vmk0
# Try to Add NFS datastores
esxcfg-nas -a -o 192.168.100.100-s /vol/Storageswap Storageswap
esxcfg-nas -a –o 192.168.100.100 -s /vol/Storagesw Storagesw
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagepage Storagepage
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storageprod Storageprod
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagesrmph Storagesrmph
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagevol0 Storagevol0
esxcfg-advcfg -s 30 /Net/TcpipHeapSize
esxcfg-advcfg -s 120 /Net/TcpipHeapMax
esxcfg-advcfg -s 10 /NFS/HeartbeatMaxFailures
esxcfg-advcfg -s 12 /NFS/HeartbeatFrequency
esxcfg-advcfg -s 5 /NFS/HeartbeatTimeout
esxcfg-advcfg -s 64 /NFS/MaxVolumes
vim-cmd hostsvc/net/refresh
There were a number of issues with the above script , well the script itself was fine but it highlighted a few issues with the coexistance of ESX and ESXi in our organisation.
once the host was deployed everything worked as expected , except HA . This appears to have been due to a misconfiguration between the Service console and the VMKernel port
ESXi no longer has a "service Console" it does however have a VMkernel port.
with our ESX setup the Service console was transmitting the HA heartbeats , obviously it was looking for an identical port on all other hosts to transmit to.
one workaround was to modify the HA settings and add a das.allownetworks0 "NetworkName" and das.allownetwork1 "NetworkName"// , the effect of this would have been
to permit other networks to send/recieve HA heartbeats.
The above fix worked ... but once i attempted to reset the HA config by renabling HA on the cluster it failed for all hosts.
The fix in the end turned out to be a lot simpler and tidier , when we initially built the hosts we followed VM best practice and
segregated the traffic at the portgroup level by putting the Service console and the VMkernel(NFS/iSCSI) out on different portgroups but on closer examiniation
this was segregation in name only as both portgroups were going out the same uplinks and both were on the same VLAN.
I cleaned up the config by putting all traffic out the same portgroup (still following best practise for ESXi), this resolved the HA issue as all HA heartbeat traffic was now going out over the
portgroup with he same name.
The script below is the updated script which also joins the ESX host to the domain and just adds one portgroup to the vswitch
- Stokes place script
- Standard install arguments
- Add DNS servers and NTP config
#
vmaccepteula
rootpw Pa55worD
install url http://[UDA_IPADDR]/esx41i/HPESX41i/
autopart --firstdisk --overwritevmfs
network --bootproto=static --device=vmnic0 --ip=[IPADDR] --gateway=10.128.134.229 --nameserver=10.128.100.100 --netmask=255.255.255.0 --hostname=[HOSTNAME]Domainname.com --addvmportgroup=0
vmaccepteula
rootpw Pa55worD
install url http://[UDA_IPADDR]/esx41i/HPESX41i/
autopart --firstdisk --overwritevmfs
network --bootproto=static --device=vmnic0 --ip=[IPADDR] --gateway=10.128.134.229 --nameserver=10.128.100.100 --netmask=255.255.255.0 --hostname=[HOSTNAME]Domainname.com --addvmportgroup=0
# We will configure some basic things during the first boot from the commandline before we add the host to vCenter
%firstboot --unsupported --interpreter=busybox
# Add an extra nic to vSwitch0 and a VLAN ID
esxcfg-vswitch -L vmnic1 vSwitch0
esxcfg-vswitch -v 26 -p 'Management Network' vSwitch0
esxcfg-vswitch -v 26 -p 'Management Network' vSwitch0
# Add Server LAN and Deployment LAN portgroups to vSwitch 0
esxcfg-vswitch -A 'Server LAN' vSwitch0
esxcfg-vswitch -v 0 -p ' Server LAN' vSwitch0
esxcfg-vswitch -A 'GDv5 Deployment SP' vSwitch0
esxcfg-vswitch -v 29 -p 'GDv5 Deployment SP' vSwitch0
esxcfg-vswitch -v 0 -p ' Server LAN' vSwitch0
esxcfg-vswitch -A 'GDv5 Deployment SP' vSwitch0
esxcfg-vswitch -v 29 -p 'GDv5 Deployment SP' vSwitch0
# Add new vSwitch for NFS/iSCSI traffic (vmnic2 and vmnic3)
esxcfg-vswitch -a vSwitch1
# Add NICs to the new vSwitch1
esxcfg-vswitch -L vmnic2 vSwitch1
esxcfg-vswitch -L vmnic3 vSwitch1
esxcfg-vswitch -L vmnic3 vSwitch1
# Add iSCSI Service Console and vmotion portgroups to vSwitch 1
esxcfg-vswitch -A 'iSCSI Service Console' vSwitch1
esxcfg-vswitch -v 27 -p 'iSCSI Service Console' vSwitch1
esxcfg-vswitch -v 27 -p 'iSCSI Service Console' vSwitch1
# Assign an ip-adress to the vMotion VMkernel and a VLAN ID to the Portgroup
esxcfg-vmknic -a -i [vMotioniSCSIiP] -n 255.255.255.0 'iSCSI Service Console'
# Add 'RDM Switch' port group to vSwitch 1
esxcfg-vswitch -A 'RDM Switch' vSwitch1
esxcfg-vswitch -v 27 -p 'RDM Switch' vSwitch1
esxcfg-vswitch -v 27 -p 'RDM Switch' vSwitch1
# Enable vMotion on the newly created VMkernel vmk1
vim-cmd hostsvc/vmotion/vnic_set vmk1
# Add DNS servers
vim-cmd hostsvc/net/dns_set --ip-addresses=10.128.100.100,10.128.100.3
# Try to configure NTP
Echo restrict default kod nomodify notrap noquerynopeer > /etc/ntp.conf
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo server 10.128.100.100 >> /etc/ntp.conf
echo driftfile /var/lib/ntp/drift >> /etc/ntp.conf
/etc/init.d/ntpd stop
/etc/init.d/ntpd start
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo server 10.128.100.100 >> /etc/ntp.conf
echo driftfile /var/lib/ntp/drift >> /etc/ntp.conf
/etc/init.d/ntpd stop
/etc/init.d/ntpd start
# Try to Add NFS datastores
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storageswap Storageswap
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagesw Storagesw
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagepage Storagepage
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storageprod Storageprod
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagesrmph Storagesrmph
esxcfg-nas -a -o 192.168.100.100 -s /vol/Storagevol0 Storagevol0
esxcfg-advcfg -s 30 /Net/TcpipHeapSize
esxcfg-advcfg -s 120 /Net/TcpipHeapMax
esxcfg-advcfg -s 10 /NFS/HeartbeatMaxFailures
esxcfg-advcfg -s 12 /NFS/HeartbeatFrequency
esxcfg-advcfg -s 5 /NFS/HeartbeatTimeout
esxcfg-advcfg -s 64 /NFS/MaxVolumes
# Try to join the Domain
cat > /tmp/joinActiveDirectory.py << JOIN_AD
import sys,re,os,urllib,urllib2,base64
import sys,re,os,urllib,urllib2,base64
# mob url
# mob login credentials -- use password = "" for build scripting
username = "root"
password = ""
password = ""
- which domain to join, and associated OU
- e.g.
- "primp-industries.com"
- "primp-industries.com/VMware Server OU"
domainname = "Domain.com/ou=esxhosts,ou=servers,ou=OU,dc=domain,dc=com"
# active directory credentials using encoded base64 password
ad_username = "username"
encodedpassword = "XXXXXXXXXXXXXXXXXX"
ad_password = base64.b64decode(encodedpassword)
encodedpassword = "XXXXXXXXXXXXXXXXXX"
ad_password = base64.b64decode(encodedpassword)
# Create global variables
global passman,authhandler,opener,req,page,page_content,nonce,headers,cookie,params,e_params
# Code to build opener with HTTP Basic Authentication
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None,url,username,password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
passman.add_password(None,url,username,password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
# Code to capture required page data and cookie required for post back to meet CSRF requirements ###
req = urllib2.Request(url)
page = urllib2.urlopen(req)
page_content= page.read()
page = urllib2.urlopen(req)
page_content= page.read()
# regex to get the vmware-session-nonce value from the hidden form entry
reg = re.compile('name="vmware-session-nonce" type="hidden" value="?([^\s^"]+)"')
nonce = reg.search(page_content).group(1)
nonce = reg.search(page_content).group(1)
# get the page headers to capture the cookie
headers = page.info()
cookie = headers.get("Set-Cookie")
cookie = headers.get("Set-Cookie")
# Code to join the domain
params = {'vmware-session-nonce':nonce,'domainName':domainname,'userName':ad_username,'password':ad_password}
e_params = urllib.urlencode(params)
req = urllib2.Request(url, e_params, headers={"Cookie":cookie})
page = urllib2.urlopen(req).read()
JOIN_AD
#execute python script to Join AD
python /tmp/joinActiveDirectory.py
vim-cmd hostsvc/net/refresh
Halt
There are a number of variables in [Brackets] , the purpose of these is to pipe values defined in the subtemplates tab into the kickstart script as it is running.
#boot into nic
2. request DHCP and PXE
3. Receive DHCP offer , PXE address and boot file name
4. boot into UDA , user is prompted for OS deployment type and prompted for password
5. User is prompted for subtemplate
6. OS Deployment starts, ESX41 is installed to host
7. kickstart script runs
8 machine is available
e_params = urllib.urlencode(params)
req = urllib2.Request(url, e_params, headers={"Cookie":cookie})
page = urllib2.urlopen(req).read()
JOIN_AD
#execute python script to Join AD
python /tmp/joinActiveDirectory.py
vim-cmd hostsvc/net/refresh
Halt
There are a number of variables in [Brackets] , the purpose of these is to pipe values defined in the subtemplates tab into the kickstart script as it is running.
#boot into nic
2. request DHCP and PXE
3. Receive DHCP offer , PXE address and boot file name
4. boot into UDA , user is prompted for OS deployment type and prompted for password
5. User is prompted for subtemplate
6. OS Deployment starts, ESX41 is installed to host
7. kickstart script runs
8 machine is available
Subscribe to:
Posts (Atom)