Puppet Class: r_profile::cloud::vsphere
- Defined in:
- manifests/cloud/vsphere.pp
Overview
R_profile::Cloud::Vsphere
Setup the dependencies for the puppetlabs/vsphere forge module and manage the passed-in hash of VMs.
The forge module uses some locally gems for Vsphere library in order to talk to the Vsphere Cloud.
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 |
# File 'manifests/cloud/vsphere.pp', line 8
class r_profile::cloud::vsphere(
Optional[String] $vsphere_host = hiera('r_profile::cloud::vsphere::host', undef),
Optional[String] $vsphere_user = hiera('r_profile::cloud::vsphere::user', undef),
Optional[String] $vsphere_password = hiera('r_profile::cloud::vsphere::password', undef),
Hash $vsphere_vm = hiera('r_profile::cloud::vsphere::vsphere_vm', {}),
Hash $vsphere_vm_default = hiera('r_profile::cloud::vsphere::vsphere_vm_default', {}),
) {
ensure_packages(
[
'gcc',
'libxslt-devel',
'patch',
'zlib-devel'
],
{
ensure => present
}
)
# Vsphere module requires some rubygems
package { "hocon":
ensure => "1.1.3",
provider => "puppet_gem",
}
package { "rbvmomi":
ensure => "present",
install_options => ['--no-ri','--no-rdoc'],
provider => "puppet_gem",
}
# If all required authentication fields are present, manage the vsphere.conf
# file and its content, otherwise leave it alone. This allows it to be
# populated by other methods if necessary
if $vsphere_host and $vsphere_user and $vsphere_password {
file { "/etc/puppetlabs/puppet/vsphere.conf":
ensure => file,
owner => 'root',
group => 'root',
mode => '0600',
content => epp("${module_name}/cloud/vsphere/vsphere.conf.epp", {
vsphere_user => $vsphere_user,
vsphere_password => $vsphere_password,
vsphere_host => $vsphere_host,
}),
}
}
$vsphere_vm.each |$title, $opts| {
vsphere_vm {
default:
* => $vsphere_vm_default,
;
$title:
* => $opts,
}
}
}
|