vCD-Module _Update
This commit is contained in:
21
Modules/VMware-vCD-Module/LICENSE
Normal file
21
Modules/VMware-vCD-Module/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Markus Kraus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Modulmanifest für das Modul "PSGet_VMware-vCD-Module"
|
||||
# Modulmanifest f<EFBFBD>r das Modul "PSGet_VMware-vCD-Module"
|
||||
#
|
||||
# Generiert von: Markus
|
||||
#
|
||||
@@ -8,52 +8,52 @@
|
||||
|
||||
@{
|
||||
|
||||
# Die diesem Manifest zugeordnete Skript- oder Binärmoduldatei.
|
||||
# Die diesem Manifest zugeordnete Skript- oder Bin<EFBFBD>rmoduldatei.
|
||||
# RootModule = ''
|
||||
|
||||
# Die Versionsnummer dieses Moduls
|
||||
ModuleVersion = '1.0.0'
|
||||
ModuleVersion = '1.3.0'
|
||||
|
||||
# ID zur eindeutigen Kennzeichnung dieses Moduls
|
||||
GUID = '1ef8a2de-ca22-4c88-8cdb-e00f35007d2a'
|
||||
|
||||
# Autor dieses Moduls
|
||||
Author = 'Markus'
|
||||
Author = 'Markus Kraus'
|
||||
|
||||
# Unternehmen oder Hersteller dieses Moduls
|
||||
CompanyName = 'mycloudrevolution.com'
|
||||
|
||||
# Urheberrechtserklärung für dieses Modul
|
||||
# Urheberrechtserkl<EFBFBD>rung f<EFBFBD>r dieses Modul
|
||||
Copyright = '(c) 2017 Markus. Alle Rechte vorbehalten.'
|
||||
|
||||
# Beschreibung der von diesem Modul bereitgestellten Funktionen
|
||||
# Description = ''
|
||||
Description = 'This a POwerShell Module based on VMware PowerCLI vCloud Director Module to extend its function'
|
||||
|
||||
# Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls
|
||||
# Die f<EFBFBD>r dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls
|
||||
# PowerShellVersion = ''
|
||||
|
||||
# Der Name des für dieses Modul erforderlichen Windows PowerShell-Hosts
|
||||
# Der Name des f<EFBFBD>r dieses Modul erforderlichen Windows PowerShell-Hosts
|
||||
# PowerShellHostName = ''
|
||||
|
||||
# Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Hosts
|
||||
# Die f<EFBFBD>r dieses Modul mindestens erforderliche Version des Windows PowerShell-Hosts
|
||||
# PowerShellHostVersion = ''
|
||||
|
||||
# Die für dieses Modul mindestens erforderliche Microsoft .NET Framework-Version
|
||||
# Die f<EFBFBD>r dieses Modul mindestens erforderliche Microsoft .NET Framework-Version
|
||||
# DotNetFrameworkVersion = ''
|
||||
|
||||
# Die für dieses Modul mindestens erforderliche Version der CLR (Common Language Runtime)
|
||||
# Die f<EFBFBD>r dieses Modul mindestens erforderliche Version der CLR (Common Language Runtime)
|
||||
# CLRVersion = ''
|
||||
|
||||
# Die für dieses Modul erforderliche Prozessorarchitektur ("Keine", "X86", "Amd64").
|
||||
# Die f<EFBFBD>r dieses Modul erforderliche Prozessorarchitektur ("Keine", "X86", "Amd64").
|
||||
# ProcessorArchitecture = ''
|
||||
|
||||
# Die Module, die vor dem Importieren dieses Moduls in die globale Umgebung geladen werden müssen
|
||||
# RequiredModules = @()
|
||||
# Die Module, die vor dem Importieren dieses Moduls in die globale Umgebung geladen werden m<EFBFBD>ssen
|
||||
RequiredModules = @('VMware.VimAutomation.Cloud')
|
||||
|
||||
# Die Assemblys, die vor dem Importieren dieses Moduls geladen werden müssen
|
||||
# Die Assemblys, die vor dem Importieren dieses Moduls geladen werden m<EFBFBD>ssen
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Die Skriptdateien (PS1-Dateien), die vor dem Importieren dieses Moduls in der Umgebung des Aufrufers ausgeführt werden.
|
||||
# Die Skriptdateien (PS1-Dateien), die vor dem Importieren dieses Moduls in der Umgebung des Aufrufers ausgef<EFBFBD>hrt werden.
|
||||
# ScriptsToProcess = @()
|
||||
|
||||
# Die Typdateien (.ps1xml), die beim Importieren dieses Moduls geladen werden sollen
|
||||
@@ -63,14 +63,16 @@ Copyright = '(c) 2017 Markus. Alle Rechte vorbehalten.'
|
||||
# FormatsToProcess = @()
|
||||
|
||||
# Die Module, die als geschachtelte Module des in "RootModule/ModuleToProcess" angegebenen Moduls importiert werden sollen.
|
||||
NestedModules = @('functions\Invoke-MyOnBoarding.psm1',
|
||||
NestedModules = @('functions\Invoke-MyOnBoarding.psm1',
|
||||
'functions\New-MyEdgeGateway.psm1',
|
||||
'functions\New-MyOrg.psm1',
|
||||
'functions\New-MyOrgAdmin.psm1',
|
||||
'functions\New-MyOrgVdc.psm1')
|
||||
'functions\New-MyOrg.psm1',
|
||||
'functions\New-MyOrgAdmin.psm1',
|
||||
'functions\New-MyOrgVdc.psm1',
|
||||
'functions\New-MyOrgNetwork.psm1'
|
||||
)
|
||||
|
||||
# Aus diesem Modul zu exportierende Funktionen
|
||||
FunctionsToExport = 'Invoke-MyOnBoarding', 'New-MyEdgeGateway', 'New-MyOrg', 'New-MyOrgAdmin', 'New-MyOrgVdc'
|
||||
FunctionsToExport = 'Invoke-MyOnBoarding', 'New-MyEdgeGateway', 'New-MyOrg', 'New-MyOrgAdmin', 'New-MyOrgVdc', 'New-MyOrgNetwork'
|
||||
|
||||
# Aus diesem Modul zu exportierende Cmdlets
|
||||
CmdletsToExport = '*'
|
||||
@@ -90,28 +92,28 @@ AliasesToExport = '*'
|
||||
# Liste aller Dateien in diesem Modulpaket
|
||||
# FileList = @()
|
||||
|
||||
# Die privaten Daten, die an das in "RootModule/ModuleToProcess" angegebene Modul übergeben werden sollen. Diese können auch eine PSData-Hashtabelle mit zusätzlichen von PowerShell verwendeten Modulmetadaten enthalten.
|
||||
# Die privaten Daten, die an das in "RootModule/ModuleToProcess" angegebene Modul <EFBFBD>bergeben werden sollen. Diese k<EFBFBD>nnen auch eine PSData-Hashtabelle mit zus<EFBFBD>tzlichen von PowerShell verwendeten Modulmetadaten enthalten.
|
||||
PrivateData = @{
|
||||
|
||||
PSData = @{
|
||||
|
||||
# Tags applied to this module. These help with module discovery in online galleries.
|
||||
# Tags = @()
|
||||
Tags = @('VMware', 'vCloud', 'PowerCLI', 'vCloudDirector', 'Automation', 'EdgeGateway', 'OrgNetwork')
|
||||
|
||||
# A URL to the license for this module.
|
||||
# LicenseUri = ''
|
||||
LicenseUri = 'https://github.com/mycloudrevolution/VMware-vCD-Module/blob/master/LICENSE'
|
||||
|
||||
# A URL to the main website for this project.
|
||||
# ProjectUri = ''
|
||||
ProjectUri = 'https://github.com/mycloudrevolution/VMware-vCD-Module'
|
||||
|
||||
# A URL to an icon representing this module.
|
||||
# IconUri = ''
|
||||
IconUri = 'https://github.com/mycloudrevolution/VMware-vCD-Module/blob/master/media/vCD_Small.png'
|
||||
|
||||
# ReleaseNotes of this module
|
||||
# ReleaseNotes = ''
|
||||
|
||||
# External dependent modules of this module
|
||||
# ExternalModuleDependencies = ''
|
||||
ExternalModuleDependencies = 'VMware.VimAutomation.Cloud'
|
||||
|
||||
} # End of PSData hashtable
|
||||
|
||||
@@ -120,7 +122,7 @@ PrivateData = @{
|
||||
# HelpInfo-URI dieses Moduls
|
||||
# HelpInfoURI = ''
|
||||
|
||||
# Standardpräfix für Befehle, die aus diesem Modul exportiert werden. Das Standardpräfix kann mit "Import-Module -Prefix" überschrieben werden.
|
||||
# Standardpr<EFBFBD>fix f<EFBFBD>r Befehle, die aus diesem Modul exportiert werden. Das Standardpr<EFBFBD>fix kann mit "Import-Module -Prefix" <EFBFBD>berschrieben werden.
|
||||
# DefaultCommandPrefix = ''
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function Invoke-MyOnBoarding {
|
||||
Function Invoke-MyOnBoarding {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates all vCD Objecst for a new IAAS Customer
|
||||
@@ -158,18 +156,22 @@ Function Invoke-MyOnBoarding {
|
||||
|
||||
if ($Configs.OrgVdc.ExternalNetwork -and $Configs.OrgVdc.EdgeGateway -like "Yes"){
|
||||
Write-Host "Edge Gateway for Org VDC '$($Configs.OrgVdc.Name)' Requested!"
|
||||
$Trash = New-MyOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $Configs.OrgVdc.NetworkPool `
|
||||
$Trash = New-MyOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $Configs.OrgVdc.NetworkPool `
|
||||
-StorageProfile $Configs.OrgVdc.StorageProfile -ProviderVDC $Configs.OrgVdc.ProviderVDC -Org $Configs.Org.Name -Enabled:$Enabled
|
||||
|
||||
$EdgeName = $Configs.Org.Name + "-ESG01"
|
||||
$EdgeName = $Configs.Org.Name + "-ESG01"
|
||||
$Trash = New-MyEdgeGateway -Name $EdgeName -OrgVDCName $Configs.OrgVdc.Name -Orgname $Configs.Org.Name -ExternalNetwork $Configs.OrgVdc.ExternalNetwork `
|
||||
-IPAddress $Configs.OrgVdc.IPAddress -SubnetMask $Configs.OrgVdc.SubnetMask -Gateway $Configs.OrgVdc.Gateway -IPRangeStart $Configs.OrgVdc.IPRangeStart -IPRangeEnd $Configs.OrgVdc.IPRangeEnd
|
||||
}
|
||||
elseif ($Configs.OrgVdc.ExternalNetwork -and $Configs.OrgVdc.EdgeGateway -like "No"){
|
||||
Write-Host "External Network for Org VDC '$($Configs.OrgVdc.Name)' Requested!"
|
||||
elseif ($Configs.OrgVdc.ExternalNetwork -and $Configs.OrgVdc.EdgeGateway -like "No"){
|
||||
$Trash = New-MyOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $Configs.OrgVdc.NetworkPool `
|
||||
-StorageProfile $Configs.OrgVdc.StorageProfile -ProviderVDC $Configs.OrgVdc.ProviderVDC -ExternalNetwork $Configs.OrgVdc.ExternalNetwork -Org $Configs.Org.Name -Enabled:$Enabled
|
||||
}
|
||||
else {
|
||||
Write-Host "No external Connection for Org VDC '$($Configs.OrgVdc.Name)' Requested!"
|
||||
}
|
||||
$Trash = New-PecOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $ProVdcNetworkPool.Name `
|
||||
-StorageProfile $Configs.OrgVdc.StorageProfile -ProviderVDC $Configs.OrgVdc.ProviderVDC -Org $Configs.Org.Name -Enabled:$Enabled
|
||||
}
|
||||
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgVdc OK" -ForegroundColor Green
|
||||
Get-OrgVdc -Org $Configs.Org.Name -Name $Configs.OrgVdc.Name | Select-Object Name, Enabled, CpuAllocationGhz, MemoryLimitGB, StorageLimitGB, AllocationModel, ThinProvisioned, UseFastProvisioning, `
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function New-MyEdgeGateway {
|
||||
Function New-MyEdgeGateway {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new Edge Gateway with Default Parameters
|
||||
@@ -9,7 +7,6 @@ Function New-MyEdgeGateway {
|
||||
Creates a new Edge Gateway with Default Parameters
|
||||
|
||||
Default Parameters are:
|
||||
* Size
|
||||
* HA State
|
||||
* DNS Relay
|
||||
|
||||
@@ -17,14 +14,14 @@ Function New-MyEdgeGateway {
|
||||
.NOTES
|
||||
File Name : New-MyEdgeGateway.ps1
|
||||
Author : Markus Kraus
|
||||
Version : 1.0
|
||||
Version : 1.1
|
||||
State : Ready
|
||||
|
||||
.LINK
|
||||
https://mycloudrevolution.com/
|
||||
|
||||
.EXAMPLE
|
||||
New-MyEdgeGateway -Name "TestEdge" -OrgVDCName "TestVDC" -OrgName "TestOrg" -ExternalNetwork "ExternalNetwork" -IPAddress "192.168.100.1" -SubnetMask "255.255.255.0" -Gateway "192.168.100.254" -IPRangeStart ""192.168.100.2" -IPRangeEnd ""192.168.100.3" -Verbose
|
||||
New-MyEdgeGateway -Name "TestEdge" -OrgVDCName "TestVDC" -OrgName "TestOrg" -Size compact -ExternalNetwork "ExternalNetwork" -IPAddress "192.168.100.1" -SubnetMask "255.255.255.0" -Gateway "192.168.100.254" -IPRangeStart ""192.168.100.2" -IPRangeEnd ""192.168.100.3" -Verbose
|
||||
|
||||
.PARAMETER Name
|
||||
Name of the New Edge Gateway as String
|
||||
@@ -35,6 +32,9 @@ Function New-MyEdgeGateway {
|
||||
.PARAMETER OrgName
|
||||
Org where the new Edge Gateway should be created as string
|
||||
|
||||
.PARAMETER Size
|
||||
Size of the new Edge Gateway as string
|
||||
|
||||
.PARAMETER ExternalNetwork
|
||||
External Network of the new Edge Gateway as String
|
||||
|
||||
@@ -69,6 +69,10 @@ Function New-MyEdgeGateway {
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Org where the new Edge Gateway should be created as string")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $OrgName,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Size of the new Edge Gateway as string")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[ValidateSet("compact","full")]
|
||||
[String] $Size,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="External Network of the New Edge Gateway as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $ExternalNetwork,
|
||||
@@ -113,7 +117,7 @@ Function New-MyEdgeGateway {
|
||||
$EdgeGateway.Name = $Name
|
||||
$EdgeGateway.Configuration = New-Object VMware.VimAutomation.Cloud.Views.GatewayConfiguration
|
||||
#$EdgeGateway.Configuration.BackwardCompatibilityMode = $false
|
||||
$EdgeGateway.Configuration.GatewayBackingConfig = "compact"
|
||||
$EdgeGateway.Configuration.GatewayBackingConfig = $Size
|
||||
$EdgeGateway.Configuration.UseDefaultRouteForDnsRelay = $false
|
||||
$EdgeGateway.Configuration.HaEnabled = $false
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function New-MyOrg {
|
||||
Function New-MyOrg {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new vCD Org with Default Parameters
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function New-MyOrgAdmin {
|
||||
Function New-MyOrgAdmin {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new vCD Org Admin with Default Parameters
|
||||
|
||||
166
Modules/VMware-vCD-Module/functions/New-MyOrgNetwork.psm1
Normal file
166
Modules/VMware-vCD-Module/functions/New-MyOrgNetwork.psm1
Normal file
@@ -0,0 +1,166 @@
|
||||
Function New-MyOrgNetwork {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new Org Network with Default Parameters
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
.NOTES
|
||||
File Name : New-MyOrgNetwork.ps1
|
||||
Author : Markus Kraus
|
||||
Version : 1.1
|
||||
State : Ready
|
||||
|
||||
.LINK
|
||||
https://mycloudrevolution.com
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgNetwork -Name Test -OrgVdcName "Test-OrgVDC" -OrgName "Test-Org" -EdgeName "Test-OrgEdge" -SubnetMask 255.255.255.0 -Gateway 192.168.66.1 -IPRangeStart 192.168.66.100 -IPRangeEnd 192.168.66.200
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgNetwork -Name Test -OrgVdcName "Test-OrgVDC" -OrgName "Test-Org" -EdgeName "Test-OrgEdge" -SubnetMask 255.255.255.0 -Gateway 192.168.66.1 -IPRangeStart 192.168.66.100 -IPRangeEnd 192.168.66.200 -Shared:$False
|
||||
|
||||
.EXAMPLE
|
||||
$params = @{ 'Name' = 'Test';
|
||||
'OrgVdcName'= 'Test-OrgVDC';
|
||||
'OrgName'='Test-Org';
|
||||
'EdgeName'='Test-OrgEdge';
|
||||
'SubnetMask' = '255.255.255.0';
|
||||
'Gateway' = '192.168.66.1';
|
||||
'IPRangeStart' = '192.168.66.100';
|
||||
'IPRangeEnd' = '192.168.66.200'
|
||||
}
|
||||
New-MyOrgNetwork @params -Verbose
|
||||
|
||||
.PARAMETER Name
|
||||
Name of the New Org Network as String
|
||||
|
||||
.PARAMETER OrgVDCName
|
||||
OrgVDC where the new Org Network should be created as string
|
||||
|
||||
.PARAMETER OrgName
|
||||
Org where the newOrg Networkshould be created as string
|
||||
|
||||
.PARAMETER EdgeName
|
||||
Edge Gateway Name for the new Org Network as String
|
||||
|
||||
.PARAMETER SubnetMask
|
||||
Subnet Mask of the New Org Network as IP Address
|
||||
|
||||
.PARAMETER Gateway
|
||||
Gateway of the New Org Network as IP Address
|
||||
|
||||
.PARAMETER IPRangeStart
|
||||
IP Range Start of the New Org Network as IP Address
|
||||
|
||||
.PARAMETER IPRangeEnd
|
||||
IP Range End of the New Org Network as IP Address
|
||||
|
||||
.PARAMETER Shared
|
||||
Switch for Shared OrgVDC Network
|
||||
|
||||
Default: $True
|
||||
|
||||
.PARAMETER Timeout
|
||||
Timeout for the Org Network to become Ready
|
||||
|
||||
Default: 120s
|
||||
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org Network as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $Name,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="OrgVDC where the new Org Network should be created as string")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $OrgVdcName,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Org where the new Org Network should be created as string")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $OrgName,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Edge Gateway Name for the new Org Network as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $EdgeName,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Subnet Mask of the New Org Network as IP Address")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[IPAddress] $SubnetMask,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Gateway of the New Org Network as IP Address")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[IPAddress] $Gateway,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="IP Range Start the New Org Network as IP Address")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[IPAddress] $IPRangeStart,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="IP Range End the New Org Network as IP Address")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[IPAddress] $IPRangeEnd,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Switch for Shared OrgVDC Network")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[Bool] $Shared = $True,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False,HelpMessage="Timeout for the Org Network to become Ready")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $Timeout = 120
|
||||
)
|
||||
Process {
|
||||
|
||||
## Get Org vDC
|
||||
Write-Verbose "Get Org vDC"
|
||||
[Array] $orgVdc = Get-Org -Name $OrgName | Get-OrgVdc -Name $OrgVdcName
|
||||
|
||||
if ( $orgVdc.Count -gt 1) {
|
||||
throw "Multiple OrgVdcs found!"
|
||||
}
|
||||
elseif ( $orgVdc.Count -lt 1) {
|
||||
throw "No OrgVdc found!"
|
||||
}
|
||||
$orgVdcView = $orgVdc| Get-CIView
|
||||
|
||||
## Get EdgeGateway
|
||||
Write-Verbose "Get EdgeGateway"
|
||||
[Array] $edgeGateway = Search-Cloud -QueryType EdgeGateway -Name $EdgeName | Get-CIView
|
||||
if ( $edgeGateway.Count -gt 1) {
|
||||
throw "Multiple EdgeGateways found!"
|
||||
}
|
||||
elseif ( $edgeGateway.Count -lt 1) {
|
||||
throw "No EdgeGateway found!"
|
||||
}
|
||||
|
||||
## Define Org Network
|
||||
Write-Verbose "Define Org Network"
|
||||
$OrgNetwork = new-object vmware.vimautomation.cloud.views.orgvdcnetwork
|
||||
$OrgNetwork.name = $Name
|
||||
$OrgNetwork.edgegateway = $edgeGateway.id
|
||||
$OrgNetwork.isshared = $Shared
|
||||
|
||||
$OrgNetwork.configuration = new-object vmware.vimautomation.cloud.views.networkconfiguration
|
||||
$OrgNetwork.configuration.fencemode = "natRouted"
|
||||
$OrgNetwork.configuration.ipscopes = new-object vmware.vimautomation.cloud.views.ipscopes
|
||||
|
||||
$Scope = new-object vmware.vimautomation.cloud.views.ipScope
|
||||
$Scope.gateway = $Gateway
|
||||
$Scope.netmask = $SubnetMask
|
||||
|
||||
$Scope.ipranges = new-object vmware.vimautomation.cloud.views.ipranges
|
||||
$Scope.ipranges.iprange = new-object vmware.vimautomation.cloud.views.iprange
|
||||
$Scope.ipranges.iprange[0].startaddress = $IPRangeStart
|
||||
$Scope.ipranges.iprange[0].endaddress = $IPRangeEnd
|
||||
|
||||
$OrgNetwork.configuration.ipscopes.ipscope += $Scope
|
||||
|
||||
## Create Org Network
|
||||
Write-Verbose "Create Org Network"
|
||||
$CreateOrgNetwork = $orgVdcView.CreateNetwork($OrgNetwork)
|
||||
|
||||
## Wait for Org Network to become Ready
|
||||
Write-Verbose "Wait for Org Network to become Ready"
|
||||
while(!(Get-OrgVdcNetwork -Id $CreateOrgNetwork.Id -ErrorAction SilentlyContinue)){
|
||||
$i++
|
||||
Start-Sleep 5
|
||||
if($i -gt $Timeout) { Write-Error "Creating Org Network."; break}
|
||||
Write-Progress -Activity "Creating Org Network" -Status "Wait for Network to become Ready..."
|
||||
}
|
||||
Write-Progress -Activity "Creating Org Network" -Completed
|
||||
Start-Sleep 1
|
||||
|
||||
Get-OrgVdcNetwork -Id $CreateOrgNetwork.Id | Select-Object Name, OrgVdc, NetworkType, DefaultGateway, Netmask, StaticIPPool, @{ N='isShared'; E = {$_.ExtensionData.isShared} } | Format-Table -AutoSize
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
#Requires -Version 4
|
||||
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
|
||||
Function New-MyOrgVdc {
|
||||
Function New-MyOrgVdc {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new vCD Org VDC with Default Parameters
|
||||
@@ -9,7 +7,6 @@ Function New-MyOrgVdc {
|
||||
Creates a new vCD Org VDC with Default Parameters
|
||||
|
||||
Default Parameters are:
|
||||
* Allocation Model
|
||||
* Network Quota
|
||||
* VM Quota
|
||||
* 'vCpu In Mhz'
|
||||
@@ -20,27 +17,38 @@ Function New-MyOrgVdc {
|
||||
.NOTES
|
||||
File Name : New-MyOrgVdc.ps1
|
||||
Author : Markus Kraus
|
||||
Version : 1.2
|
||||
Version : 1.3
|
||||
State : Ready
|
||||
|
||||
.LINK
|
||||
https://mycloudrevolution.com/
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg" -ExternalNetwork "External_OrgVdcNet"
|
||||
New-MyOrgVdc -Name "TestVdc" -AllocationModel AllocationPool -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg" -ExternalNetwork "External_OrgVdcNet"
|
||||
|
||||
.EXAMPLE
|
||||
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg"
|
||||
New-MyOrgVdc -Name "TestVdc" -AllocationModel AllocationVApp -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg"
|
||||
|
||||
.PARAMETER Name
|
||||
Name of the New Org VDC as String
|
||||
|
||||
.PARAMETER AllocationModel
|
||||
Allocation Model of the New Org VDC as String
|
||||
|
||||
.PARAMETER CPULimit
|
||||
CPU Limit (MHz) of the New Org VDC as String
|
||||
|
||||
Default: 0 (Unlimited)
|
||||
|
||||
Note: If AllocationModel is not AllocationVApp (Pay as you go), a limit needs to be set
|
||||
|
||||
.PARAMETER MEMLimit
|
||||
Memory Limit (MB) of the New Org VDC as String
|
||||
|
||||
Default: 0 (Unlimited)
|
||||
|
||||
Note: If AllocationModel is not AllocationVApp (Pay as you go), a limit needs to be set
|
||||
|
||||
.PARAMETER StorageLimit
|
||||
Storage Limit (MB) of the New Org VDC as String
|
||||
|
||||
@@ -76,12 +84,16 @@ Function New-MyOrgVdc {
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[String] $Name,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="CPU Limit (MHz) of the New Org VDC as String")]
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Allocation Model of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $CPULimit,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Memory Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateSet("AllocationPool","AllocationVApp")]
|
||||
[String] $AllocationModel,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="CPU Limit (MHz) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $MEMLimit,
|
||||
[int] $CPULimit = 0,
|
||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Memory Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $MEMLimit = 0,
|
||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Storage Limit (MB) of the New Org VDC as String")]
|
||||
[ValidateNotNullorEmpty()]
|
||||
[int] $StorageLimit,
|
||||
@@ -117,7 +129,7 @@ Function New-MyOrgVdc {
|
||||
$providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
|
||||
$providerVdcRef.Href = $OrgVdcproviderVdc.Href
|
||||
$adminVdc.ProviderVdcReference = $providerVdcRef
|
||||
$adminVdc.AllocationModel = "AllocationPool"
|
||||
$adminVdc.AllocationModel = $AllocationModel
|
||||
$adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity
|
||||
$adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
|
||||
$adminVdc.ComputeCapacity.Cpu.Units = "MHz"
|
||||
@@ -132,8 +144,8 @@ Function New-MyOrgVdc {
|
||||
$adminVdc.StorageCapacity.Limit = $StorageLimit
|
||||
$adminVdc.NetworkQuota = 10
|
||||
$adminVdc.VmQuota = 0
|
||||
$adminVdc.VCpuInMhz = 1000
|
||||
$adminVdc.VCpuInMhz2 = 1000
|
||||
$adminVdc.VCpuInMhz = 2000
|
||||
$adminVdc.VCpuInMhz2 = 2000
|
||||
$adminVdc.UsesFastProvisioning = $false
|
||||
$adminVdc.IsThinProvision = $true
|
||||
|
||||
@@ -143,20 +155,21 @@ Function New-MyOrgVdc {
|
||||
$orgVdc = $orgED.CreateVdc($adminVdc)
|
||||
|
||||
## Wait for getting Ready
|
||||
Write-Verbose "Wait for getting Ready"
|
||||
Write-Verbose "Wait for OrgVdc getting Ready after creation"
|
||||
$i = 0
|
||||
while(($orgVdc = Get-OrgVdc -Name $Name -Verbose:$false).Status -eq "NotReady"){
|
||||
$i++
|
||||
Start-Sleep 2
|
||||
if($i -gt $Timeout) { Write-Error "Creating Org Failed."; break}
|
||||
Write-Progress -Activity "Creating Org" -Status "Wait for Org to become Ready..."
|
||||
if($i -gt $Timeout) { Write-Error "Creating OrgVdc Failed."; break}
|
||||
Write-Progress -Activity "Creating OrgVdc" -Status "Wait for OrgVdc to become Ready..."
|
||||
}
|
||||
Write-Progress -Activity "Creating Org" -Completed
|
||||
Write-Progress -Activity "Creating OrgVdc" -Completed
|
||||
Start-Sleep 2
|
||||
|
||||
## Search given Storage Profile
|
||||
Write-Verbose "Search given Storage Profile"
|
||||
$ProVdcStorageProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $StorageProfile | Get-CIView
|
||||
$Filter = "ProviderVdc==" + $OrgVdcproviderVdc.Id
|
||||
$ProVdcStorageProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $StorageProfile -Filter $Filter | Get-CIView
|
||||
|
||||
## Create Storage Profile Object with Settings
|
||||
Write-Verbose "Create Storage Profile Object with Settings"
|
||||
@@ -174,14 +187,14 @@ Function New-MyOrgVdc {
|
||||
$orgVdc.ExtensionData.CreateVdcStorageProfile($UpdateParams)
|
||||
|
||||
## Wait for getting Ready
|
||||
Write-Verbose "Wait for getting Ready"
|
||||
Write-Verbose "Wait for OrgVdc getting Ready after update"
|
||||
while(($orgVdc = Get-OrgVdc -Name $name -Verbose:$false).Status -eq "NotReady"){
|
||||
$i++
|
||||
Start-Sleep 1
|
||||
if($i -gt $Timeout) { Write-Error "Update Org Failed."; break}
|
||||
Write-Progress -Activity "Updating Org" -Status "Wait for Org to become Ready..."
|
||||
if($i -gt $Timeout) { Write-Error "Update OrgVdc Failed."; break}
|
||||
Write-Progress -Activity "Updating OrgVdc" -Status "Wait for OrgVdc to become Ready..."
|
||||
}
|
||||
Write-Progress -Activity "Updating Org" -Completed
|
||||
Write-Progress -Activity "Updating OrgVdc" -Completed
|
||||
Start-Sleep 1
|
||||
|
||||
## Search Any-StorageProfile
|
||||
|
||||
Reference in New Issue
Block a user