Skip to content

Commit

Permalink
fix: addressing pipeline issues (#554)
Browse files Browse the repository at this point in the history
- Updated affinityRule for vrli and vrops
- Fix issue with message output for `Add-vROPSNsxCredential`
- Remove anti-affinity procedure from `Invoke-IomDeployment`

Signed-off-by: Gary Blake <gblake@vmware.com>
  • Loading branch information
GaryJBlake authored Mar 25, 2024
1 parent a97ee84 commit a0ec60a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion PowerValidatedSolutions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'PowerValidatedSolutions.psm1'

# Version number of this module.
ModuleVersion = '2.9.0.1048'
ModuleVersion = '2.9.0.1049'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
46 changes: 22 additions & 24 deletions PowerValidatedSolutions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,27 @@ Function Invoke-IamDeployment {
$pvsModulePath = (Get-InstalledModule -Name PowerValidatedSolutions).InstalledLocation
$nsxVsphereTemplate = $pvsModulePath + "\vSphereRoles\" + "nsx-vsphere-integration.role"

Show-PowerValidatedSolutionsOutput -message "Adding Active Directory as an Identity Provider in vCenter Server"
foreach ($sddcDomain in $allWorkloadDomains) {
if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) {
if ($jsonInput.vcenterAdConnectionType -eq "LDAPS") {
$StatusMsg = Add-IdentitySource -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUserVsphere -domainBindPass $jsonInput.domainBindPassVsphere -dcMachineName $jsonInput.domainControllerMachineName -baseGroupDn $jsonInput.baseGroupDn -baseUserDn $jsonInput.baseUserDn -protocol ldaps -certificate $rootCertificate -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
} else {
$StatusMsg = Add-IdentitySource -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUserVsphere -domainBindPass $jsonInput.domainBindPassVsphere -dcMachineName $jsonInput.domainControllerMachineName -baseGroupDn $jsonInput.baseGroupDn -baseUserDn $jsonInput.baseUserDn -protocol ldap -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
if (!$failureDetected) {
Show-PowerValidatedSolutionsOutput -message "Defining a Custom Role in vSphere for the NSX Service Accounts"
foreach ($sddcDomain in $allWorkloadDomains) {
if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) {
$StatusMsg = Add-vSphereRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -roleName $jsonInput.vsphereRoleName -template $nsxVsphereTemplate -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
}
}
}

if (!$failureDetected) {
Show-PowerValidatedSolutionsOutput -message "Defining a Custom Role in vSphere for the NSX Service Accounts"
Show-PowerValidatedSolutionsOutput -message "Adding Active Directory as an Identity Provider in vCenter Server"
foreach ($sddcDomain in $allWorkloadDomains) {
if ($sddcDomain.type -eq "MANAGEMENT" -or ($sddcDomain.type -eq "VI" -and $sddcDomain.ssoName -ne "vsphere.local")) {
$StatusMsg = Add-vSphereRole -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -roleName $jsonInput.vsphereRoleName -template $nsxVsphereTemplate -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
if ($jsonInput.vcenterAdConnectionType -eq "LDAPS") {
$StatusMsg = Add-IdentitySource -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUserVsphere -domainBindPass $jsonInput.domainBindPassVsphere -dcMachineName $jsonInput.domainControllerMachineName -baseGroupDn $jsonInput.baseGroupDn -baseUserDn $jsonInput.baseUserDn -protocol ldaps -certificate $rootCertificate -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
} else {
$StatusMsg = Add-IdentitySource -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -sddcDomain $sddcDomain.name -domain $jsonInput.domainFqdn -domainBindUser $jsonInput.domainBindUserVsphere -domainBindPass $jsonInput.domainBindPassVsphere -dcMachineName $jsonInput.domainControllerMachineName -baseGroupDn $jsonInput.baseGroupDn -baseUserDn $jsonInput.baseUserDn -protocol ldap -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
}
}
}
}
Expand Down Expand Up @@ -12718,11 +12720,11 @@ Function Export-vRLIJsonSpec {
'licenseRef' = ("locker:license:" + $($vrliLicense.vmid) + ":" + $($vrliLicense.alias))
'nodeSize' = $jsonInput.nodeSize
'configureClusterVIP' = "false"
'affinityRule' = $true
'affinityRule' = "true"
'configureAffinitySeparateAll' = "true"
'isUpgradeVmCompatibility' = $true
'vrliAlwaysUseEnglish' = $false
'masterVidmEnabled' = $false
'isUpgradeVmCompatibility' = "true"
'vrliAlwaysUseEnglish' = "false"
'masterVidmEnabled' = "false"
'contentLibraryItemId' = $contentLibraryItemId
'ntp' = $jsonInput.ntp
'timeSyncMode' = "ntp"
Expand Down Expand Up @@ -15939,8 +15941,6 @@ Function Invoke-IomDeployment {

if (!$failureDetected) {
Show-PowerValidatedSolutionsOutput -message "Configuring vSphere DRS Anti-Affinity Rules for the $operationsProductName Appliances"
$StatusMsg = Add-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameOperations -antiAffinityVMs $jsonInput.vmListOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
$StatusMsg = Add-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameProxies -antiAffinityVMs $jsonInput.vmListProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
}
Expand Down Expand Up @@ -16145,8 +16145,6 @@ Function Invoke-UndoIomDeployment {

if (!$failureDetected) {
Show-PowerValidatedSolutionsOutput -message "Removing vSphere DRS Anti-Affinity Rules for the $operationsProductName Appliances"
$StatusMsg = Undo-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
$StatusMsg = Undo-AntiAffinityRule -server $jsonInput.sddcManagerFqdn -user $jsonInput.sddcManagerUser -pass $jsonInput.sddcManagerPass -domain $jsonInput.mgmtSddcDomainName -ruleName $jsonInput.antiAffinityRuleNameProxies -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg
messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) {$failureDetected = $true}
}
Expand Down Expand Up @@ -16397,7 +16395,7 @@ Function Export-vROPsJsonSpec {
'disableTls' = "TLSv1,TLSv1.1"
'fipsMode' = "false"
'timeSyncMode' = "ntp"
'masterVidmEnabled' = $true
'masterVidmEnabled' = "true"
'ntp' = $jsonInput.ntp
'affinityRule' = $true
'configureAffinitySeparateAll' = "true"
Expand Down Expand Up @@ -19596,12 +19594,12 @@ Function Add-vROPSNsxCredential {
Add-vROPSCredential -json .\addCredential.json | Out-Null
Remove-Item .\addCredential.json -Force -Confirm:$false
if (Get-vROPSCredential | Where-Object {$_.name -eq $credentialName}) {
Write-Output "Adding $credentialType to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName): SUCCESSFUL"
Write-Output "Adding NSX Credential to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName): SUCCESSFUL"
} else {
Write-Error "Adding $credentialType to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName): POST_VALIDATION_FAILED"
Write-Error "Adding NSX Credential to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName): POST_VALIDATION_FAILED"
}
} else {
Write-Warning "Adding $credentialType to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName), already exists: SKIPPED"
Write-Warning "Adding NSX Credential to VMware Aria Operations ($($vcfVropsDetails.loadBalancerFqdn)) named ($credentialName), already exists: SKIPPED"
}
}
}
Expand Down Expand Up @@ -20419,7 +20417,7 @@ Function Export-vRAJsonSpec {
'fipsMode' = "false"
'timeSyncMode' = "ntp"
'ntp' = $jsonInput.ntp
'affinityRule' = $false
'affinityRule' = "false"
'configureAffinitySeparateAll' = "false"
'contentLibraryItemId' = $contentLibraryItemId
'nodeSize' = $jsonInput.nodeSize.ToLower()
Expand Down

0 comments on commit a0ec60a

Please sign in to comment.