RamblingCookieMonster / PSDeploy

Simple PowerShell based deployments
http://ramblingcookiemonster.github.io/PSDeploy-Take-Two/
MIT License
348 stars 69 forks source link

New deployment type proposal: vSphereOVF #51

Closed equelin closed 8 years ago

equelin commented 8 years ago

Please find below the documentation I've written for a new deployment type vSphereOVF. Feel free to give any feedback ! (cc to VMware folks @lamw @alanrenouf)

Deployment script can be found here.


OVF or OVA are a standard way to package virtual machines. vSphereOVF will allow you to easely deploy an OVF/OVA into a VMware vSPhere infrastructure.

Prerequisites

Before deploying you'll need to:

Here is an example deployment config:

Deploy 'MyOVF' {
    By vSphereOVF {
        FromSource 'C:\MyOVF.ovf'
        To 'esxi.example.com'
        Tagged 'Prod'
        WithOptions @{
            Name = 'VM01'
            Datastore = 'DATASTORE01'
            OvfConfiguration = @{
                'NetworkMapping.VM Network' = 'Production'
            }
            PowerOn = $true
        }
    }
}

Let's explain the different parameters:

Here is an example to deploy a VMware vCenter Virtual Appliance (VCSA). More specific informations about the automated deployment of a VCSA can be found here

Deploy 'VCSA' {
    By vSphereOVF {
        FromSource 'D:\VMware\vSphere\vSphere 6.0\vCenter\VCSA\U2\vmware-vcsa.ova'
        To 'esxi.example.com'
        Tagged 'Prod'
        WithOptions @{
            Name = 'VCENTER' # VM Name
            Datastore = 'SALLE1-DATASTORE02' # Datastore Name
            OvfConfiguration = @{
                'NetworkMapping.Network 1'                = 'Supervision' # vSphere Portgroup Network Mapping
                'DeploymentOption.value'                  = 'tiny' # tiny,small,medium,large,management-tiny,management-small,management-medium,management-large,infrastructure
                'IpAssignment.IpProtocol'                 = 'IPv4' # IP Protocol
                'guestinfo.cis.appliance.net.addr.family' = 'ipv4' # IP Address Family
                'guestinfo.cis.appliance.net.mode'        = 'static' # IP Address Mode
                'guestinfo.cis.appliance.net.addr'        = '192.168.1.2' # IP Address 
                'guestinfo.cis.appliance.net.pnid'        = '192.168.1.2' # IP PNID (same as IP Address if there's no DNS)
                'guestinfo.cis.appliance.net.prefix'      = '24' # IP Network Prefix (CIDR notation)
                'guestinfo.cis.appliance.net.gateway'     = '192.168.1.254' # IP Gateway
                'guestinfo.cis.appliance.net.dns.servers' = '192.168.1.1' # Comma separated list of IP addresses of DNS servers.
                'guestinfo.cis.appliance.ntp.servers'     = '0.pool.ntp.org' # Comma seperated list of hostnames or IP addresses of NTP Servers
                'guestinfo.cis.appliance.root.passwd'     = 'VMware1!' # Root Password
                'guestinfo.cis.appliance.ssh.enabled'     = 'True' # Enable SSH
                'guestinfo.cis.vmdir.domain-name'         = 'vsphere.local' # SSO Domain Name
                'guestinfo.cis.vmdir.site-name'           = 'site01' # SSO Site Name
                'guestinfo.cis.vmdir.password'            = 'VMware1!' # SSO Admin Password
            }
            PowerOn = $true
        }
    }
}
devblackops commented 8 years ago

Nice. This relates pretty closely with my POSHOrigin_vSphere DSC module. OVF/OVA resources are something I've been meaning to add.

equelin commented 8 years ago

Thanks @devblackops. your project seems quiet interesting! Good work!

equelin commented 8 years ago

@RamblingCookieMonster Do you mind if I create a repo for gathering psdeploy.ps1 examples for deploying popular OVF/OVA appliances ? Or maybe you have something in mind for the other deployment types ?

RamblingCookieMonster commented 8 years ago

Up to you! If you wanted something more generic, I'd also be up for either of the following as well:

Your own repo, or either of the latter work though, up to you!

Cheers!

lamw commented 8 years ago

@equelin You can find quite a few examples here https://github.com/lamw/PowerCLI-Deployment as well as from my blog on past OVF/OVAs. It would be good to get a repo that checks the version of the appliance, as some will have new/updated properties

equelin commented 8 years ago

@RamblingCookieMonster Your project, your rules ;-) I'm not really aware of github's organization but it might be a good idea as PSDeploy is gaining more attraction. I Think that a side repo for vSphereOVF might be good if you look at @lamw repository there could be a lot of example !

@lamw That's your blog post that gave me the idea to use PSDeploy for deploying OVF but I was not aware of your repository. I hope you don't mind if I borrow your idea!? Subfolders for appliance version is a really good idea !

RamblingCookieMonster commented 8 years ago

I overcomplicated things : P I think the easiest thing for now would be for you to just create that repo.

Down the line, could move PSDeploy to the psdeploy organization. If your repo was only related to psdeploy, you could make the transfer as well if you wanted (existing things shouldn't break). Don't see any compelling reason to transfer things now though.

Very cool idea, so basically a library of recipes for certain deployments?

Cheers!

equelin commented 8 years ago

just create that repo.

Ok !

Very cool idea, so basically a library of recipes for certain deployments?

Exactly, I was thinking of simple recipes involving one appliance and perhapes more complicated ones for deploying a complete infrastructure (maybe with Pester and PSake...).

equelin commented 8 years ago

Here we go !

https://github.com/equelin/PSDeploy-vSphereOVF-Recipes/tree/develop/Sexibytes/Sexigraf

alanrenouf commented 8 years ago

This is cool, love it!

RamblingCookieMonster commented 8 years ago

Closing this out, thanks again @equelin!