My Profile Photo Title

Thoughts about DevOps and automation from a Windows guy


Idea for VMware Provisioning with DSC feature image

Idea for VMware Provisioning with DSC

UPDATE - I’ve started a series of posts about POSHOrigin. A PowerShell module and DSC resource that takes this to the next level. Check it out here.

Here is an idea for VM Provisioning with DSC. This is how a custom DSC resource might look like in order to deploy a VM into a given vCenter. This DSC configuration would not target the VM itself but rather the vCenter server or maybe a proxy server with PowerCLI installed. More to come on this as I actually start writing the module. Stay tuned.

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
Configuration WebServerVMDeploy {
    param ()

    Import-DscResource -ModuleName cVMware

    Node "localhost" {
        cVM deployVM {
            Ensure = "Present"
            Name = "webServer01"
            vCenter = "vcenter01.local"
            Datacenter = "Prod Datacenter"
            Cluster = "ProdCluster01"
            Template = "windows2012R2StdTemplate"
            vCPU = @{
                "Sockets" = "1";
                "Cores" = "2";
            }
            vRAM = 4
            Disks = @(
                @{
                    "SizeGB" = "40"
                    "Datastore" = "Datastore01"
                    "Format" = "Thin"
                },
                @{
                    "SizeGB" = "20"
                    "Datastore" = "Datastore02"
                    "Format" = "ThickLazyZero"
                }
            )
            NICs = @(
                @{
                    "IP" = "192.168.100.100"
                    "NetMask" = "255.255.255.0"
                    "Gateway" = "192.168.100.1"
                    "PortGroup" = "WebPortGroup01"
                }
            )
        }
    }
}

$MOFpath = 'C:\Scripts\DSC\VMWareTest'
WebServerVMDeploy -OutputPath $MOFpath
Start-DscConfiguration -ComputerName 'localhost' -Wait -Force -Verbose -Path $MOFpath
Sharing is caring