Puppet Class: r_profile::vsphere

Defined in:
manifests/vsphere.pp

Overview

Glue profile to configure the puppetlabs vsphere module and then create any VMs listed in heira. If none are listed, attempt to create an vms from a list of zero targets (the empty has on the vsphere_vms hash - do nothing)

params [vcenter_host] hostname or IP address of vcenter server [vcenter_user] user to login to vcenter as [vcenter_password] Password to login to vcenter with [vcenter_port] Port for vcenter API [vsphere_defaults] Hash of default options for vsphere_vm resources. Defaults to empty hash (no default options) if nothing found in hiera [vsphere_vms] Has of VM images to create defaults to empty hash (no VMs if nothing found in hiera)

Parameters:

  • vcenter_host (Any) (defaults to: hiera("r_profile::vsphere::vcenter_host"))
  • vcenter_user (Any) (defaults to: hiera("r_profile::vsphere::vcenter_user"))
  • vcenter_password (Any) (defaults to: hiera("r_profile::vsphere::vcenter_password"))
  • vcenter_port (Any) (defaults to: hiera("r_profile::vsphere::vcenter_port"))
  • vsphere_defaults (Any) (defaults to: hiera("r_profile::vsphere::vsphere_defaults", {}))
  • vsphere_vms (Any) (defaults to: hiera("r_profile::vsphere::vsphere_vms", {}))


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'manifests/vsphere.pp', line 20

class r_profile::vsphere(
    $vcenter_host     = hiera("r_profile::vsphere::vcenter_host"),
    $vcenter_user     = hiera("r_profile::vsphere::vcenter_user"),
    $vcenter_password = hiera("r_profile::vsphere::vcenter_password"),
    $vcenter_port     = hiera("r_profile::vsphere::vcenter_port"),
    $vsphere_defaults = hiera("r_profile::vsphere::vsphere_defaults", {}),
    $vsphere_vms      = hiera("r_profile::vsphere::vsphere_vms", {}),
) {

  validate_hash($vsphere_defaults)
  validate_hash($vsphere_vms)

  # setup packages and vsphere.conf file
  class { "vsphere_support":
    vcenter_host     => $vcenter_host,
    vcenter_user     => $vcenter_user,
    vcenter_password => $vcenter_password,
    vcenter_port     => $vcenter_port,
  }

  create_resources("vsphere_vm", $vsphere_vms, $vsphere_defaults)
}