Puppet Class: openvmtools
- Defined in:
- manifests/init.pp
Overview
Class: openvmtools
This class handles installing the Open Virtual Machine Tools.
Parameters:
- ensure
-
Ensure if present or absent. Default: present
- autoupgrade
-
Upgrade package automatically, if there is a newer version. Default: false
- desktop_package_conflicts
-
Boolean that determines whether the desktop conflicts includes and conflicts with the base package. Only set this if your platform is not supported or you know what you are doing. Default: auto-set, platform specific
- desktop_package_name
-
Name of the desktop package. Only set this if your platform is not supported or you know what you are doing. Default: auto-set, platform specific
- manage_epel
-
Boolean that determines if stahnma-epel is required for packages. This should only needed for RedHat (EL) 6. Default: auto-set, platform specific
- package_name
-
Name of the package. Only set this if your platform is not supported or you know what you are doing. Default: auto-set, platform specific
- service_enable
-
Start service at boot. Default: true
- service_ensure
-
Ensure if service is running or stopped. Default: running
- service_hasstatus
-
Service has status command. Only set this if your platform is not supported or you know what you are doing. Default: auto-set, platform specific
- service_name
-
Name of openvmtools service(s). Only set this if your platform is not supported or you know what you are doing. Default: auto-set, platform specific
- service_pattern
-
Pattern to look for in the process table to determine if the daemon is running. Only set this if your platform is not supported or you know what you are doing. Default: vmtoolsd
- uninstall_vmware_tools
-
Boolean that determines whether the conflicting VMWare Tools package should be uninstalled, if present. Default: false
- with_desktop
-
Whether or not to install the desktop/GUI support. Default: false
Sample Usage:
include openvmtools
Authors:
Mike Arnold <mike@razorsedge.org> Vox Pupuli <voxpupuli@groups.io>
Copyright:
Copyright © 2017 Vox Pupuli
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'manifests/init.pp', line 87
class openvmtools (
Enum['absent','present'] $ensure = 'present',
Boolean $autoupgrade = false,
Boolean $desktop_package_conflicts = false,
String[1] $desktop_package_name = 'open-vm-tools-desktop',
Boolean $manage_epel = false,
String[1] $package_name = 'open-vm-tools',
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_hasstatus = true,
Variant[String[1],Array[String[1]]] $service_name = ['vgauthd', 'vmtoolsd'],
Optional[String[1]] $service_pattern = undef,
Boolean $supported = false,
Boolean $uninstall_vmware_tools = false,
Boolean $with_desktop = false,
) {
if $facts['virtual'] == 'vmware' {
if $supported {
if $ensure == 'present' {
$package_ensure = $autoupgrade ? {
true => 'latest',
default => 'present',
}
$service_ensure_real = $service_ensure
} else { # ensure == 'absent'
$package_ensure = 'absent'
$service_ensure_real = 'stopped'
}
$packages = $with_desktop ? {
true => $desktop_package_conflicts ? {
true => [ $desktop_package_name ],
default => [ $package_name, $desktop_package_name ],
},
default => [ $package_name ],
}
if $manage_epel {
include epel
Yumrepo['epel'] -> Package[$packages]
}
if $uninstall_vmware_tools {
if $facts['vmware_uninstaller'] =~ Stdlib::Unixpath {
$vmware_lib = $facts['vmware_uninstaller'].regex_replace(
'bin/vmware-uninstall-tools.pl',
'lib/vmware-tools'
)
exec { 'vmware-uninstall-tools':
command => "${facts['vmware_uninstaller']} && rm -rf ${vmware_lib} ${facts['vmware_uninstaller']}",
before => Package['VMwareTools'],
}
}
package { 'VMwareTools':
ensure => 'absent',
before => Package[$packages],
}
}
package { $packages:
ensure => $package_ensure,
}
service { $service_name:
ensure => $service_ensure_real,
enable => $service_enable,
hasstatus => $service_hasstatus,
pattern => $service_pattern,
require => Package[$packages],
}
} else { # ! $supported
notice("Your operating system ${facts['os']['name']} is unsupported and will not have the Open Virtual Machine Tools installed.")
}
} else {
# If we are not on VMware, do not do anything.
}
}
|