Hi
I am new to nsx automation. I am working on a environment which contains new cluster and old cluster. couple of nodes from old clusters are not part of the nsx cluster. The new cluster is going to be part of nsx cluster, host preparation and vxlan configuration. The nsx manager is same for old and new cluster.
Before preparation of nsx cluster. 1:- check how many cluster are part of nsx installation 2:- I would like to check the hosts in cluster are meet the pre-requisites of nsx host preparation. 3:- check the vtep pool , if no vtep pool then create the vtep pool 4:- the new cluster should be part of the transport zone with option of hybrid.
any reference or sample code will be appreciate. thank you.
Please do go through below links
VMware NSX Day 1 Guide Library - Network Virtualization
Considering your environment , this document may be a perfect one -> https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/products/nsx/building-nsx-powered-...
Host Preparation – Route to Cloud
thank you for the input.
I started the script.....
$clustcount=$(Get-cluster).count
for($k=1;$k -le $clustcount-1;$k++){
$hostprepstatus = get-cluster $clust01[$k] | Get-NsxClusterStatus | Where-Object {$_.featureId -Match "com.vmware.vshield.vsm.nwfabric.hostPrep"} |select status
$hostvxlanstatus = get-cluster $clust01[$k] | Get-NsxClusterStatus | Where-Object {$_.featureId -Match "com.vmware.vshield.vsm.vxlan"} |select status
}
If($hostprepstatus.status -eq 'GREEN'-AND $hostvxlanstatus.status -eq 'GREEN')
{
Write-host "The cluster "$clust01[$k] " is already NSX prepared cluster" -ForegroundColor "Green"
}
else
{
Write-host "The cluster "$clust01[$k] " is unprepared NSX cluster"
Question:- The cluster is prepared, some times the vxlan is not configured on all host. How to check which host is not prepared for vxlan?
I write the below scripts
$NSXclust01= Get-Cluster -errorAction Stop
$NSXhost01= Get-VMHost -errorAction Stop
ForEach ($NSXclust in $NSXclust01){ ####01 strating###############Checking the cluster connected in vCenter is NSX prepared cluster or not.
Write-Host "Checking the cluster"$NSXclust.name "is NSX Prepared Cluster or not".
$NSXhost01 = Get-VMHost -Location $NSXclust.name
foreach ($NSXhost in $NSXhost01) { ####02 strating###############Checking the Host are Connected or Maintenance State
If(($NSXhost.ConnectionState -contains "Maintenance")-or($NSXhost.ConnectionState -contains "Connected")){ ####03 strating
$NSXviblist01 = Get-ESXcli -VMHost $NSXhost.name
################Check is the NSX VIB is installed on ESXi host or not.
$NSXvblist = $NSXviblist01.software.vib.list() | Select ID where { $_.ID -match "esx-nsxv"}
$count01=0;
IF(($NSXvblist -eq "esx-nsxv") { ####04 strating
$count01 = $count01+1;
} ####04 ending if--else
else {
$NSXhostpending = $NSXhost.name
Write-host "This Host"$NSXhostpending"is not prepared". }
} ####03 ending If--else####
else {Write-Host "Host not in connection state" }
} #####02 ending the foreach in Host.
If ($NSXhcount -eq $count01) { ####05 strating
Write-Host "The Cluster"$NSXclust.name "is already Prepared"
} ####05 ending if-else
else { ####06 Starting
$cunpcount01 = $cunpcount01 + 1
Write-Host "The cluster"$NSXclust.name"is not Prepared"
} ####06 ended
explanation:- I am trying to get each host in cluster, and check the VIB installed in that host, checking the host count with vib installed host. If the host is not installed with the VIB, then the host should be configured for vxlan.
Please correct me if i am wrong. Is there any better way to improve the scripts, to check vxlan configured vs vxlan unconfigured?
Appreciate your time and support.