forked from alanrenouf/PowerCLI-Deployment
/
Deployment-PSC-Replication.ps1
executable file
·75 lines (52 loc) · 2.63 KB
/
Deployment-PSC-Replication.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Author: William Lam
# Site: www.virtuallyghetto.com
# Reference: http://www.virtuallyghetto.com/2015/01/ultimate-automation-guide-to-deploying-vcsa-6-0-part-3-replicated-platform-service-controller-node.html
# Load OVF/OVA configuration into a variable
$ovffile = "Z:\Storage\Images\Beta\VMware-VCSA-all-6.0.0-2497477\vcsa\vmware-vcsa.ova"
$ovfconfig = Get-OvfConfiguration $ovffile
# vSphere Cluster + VM Network configurations
$Cluster = "Mini-Cluster"
$VMName = "PS-psc-02"
$VMNetwork = "VM Network"
$VMHost = Get-Cluster $Cluster | Get-VMHost | Sort MemoryGB | Select -first 1
$Datastore = $VMHost | Get-datastore | Sort FreeSpaceGB -Descending | Select -first 1
$Network = Get-VirtualPortGroup -Name $VMNetwork -VMHost $vmhost
# Fill out the OVF/OVA configuration parameters
# vSphere Portgroup Network Mapping
$ovfconfig.NetworkMapping.Network_1.value = $Network
# tiny,small,medium,large,management-tiny,management-small,management-medium,management-large,infrastructure
$ovfconfig.DeploymentOption.value = "infrastructure"
# IP Protocol
$ovfconfig.IpAssignment.IpProtocol.value = "IPv4"
# IP Address Family
$ovfconfig.Common.guestinfo.cis.appliance.net.addr.family.value = "ipv4"
# IP Address Mode
$ovfconfig.Common.guestinfo.cis.appliance.net.mode.value = "static"
# IP Address
$ovfconfig.Common.guestinfo.cis.appliance.net.addr_1.value = "192.168.1.71"
# IP PNID (same as IP Address if there's no DNS)
$ovfconfig.Common.guestinfo.cis.appliance.net.pnid.value = "192.168.1.71"
# IP Network Prefix (CIDR notation)
$ovfconfig.Common.guestinfo.cis.appliance.net.prefix.value = "24"
# IP Gateway
$ovfconfig.Common.guestinfo.cis.appliance.net.gateway.value = "192.168.1.1"
# DNS
$ovfconfig.Common.guestinfo.cis.appliance.net.dns.servers.value = "192.168.1.1"
# Root Password
$ovfconfig.Common.guestinfo.cis.appliance.root.passwd.value = "VMware1!"
# Enable SSH
$ovfconfig.Common.guestinfo.cis.appliance.ssh.enabled.value = "True"
# SSO Domain Name
$ovfconfig.Common.guestinfo.cis.vmdir.domain_name.value = "vghetto.local"
# SSO Site Name
$ovfconfig.Common.guestinfo.cis.vmdir.site_name.value = "vghetto"
# SSO Admin Password
$ovfconfig.Common.guestinfo.cis.vmdir.password.value = "VMware1!"
# NTP Servers
$ovfconfig.Common.guestinfo.cis.appliance.ntp.servers.value = "0.pool.ntp.org"
# First PSC Instance
$ovfconfig.Common.guestinfo.cis.vmdir.first_instance.value = "False"
# PSC Node
$ovfconfig.Common.guestinfo.cis.vmdir.replication_partner_hostname.value = "192.168.1.70"
# Deploy the OVF/OVA with the config parameters
Import-VApp -Source $ovffile -OvfConfiguration $ovfconfig -Name $VMName -VMHost $vmhost -Datastore $datastore -DiskStorageFormat thin