Puppet Class: openvmtools

Defined in:
manifests/init.pp

Summary

Install the Open Virtual Machine Tools.

Overview

Examples:

Default usage

include openvmtools

Force pass supported os check on OS non in supported list

class { 'openvmtools':
  supported => true,
}

Parameters:

  • ensure (Enum['absent','present']) (defaults to: 'present')

    Ensure if present or absent.

  • autoupgrade (Boolean) (defaults to: false)

    Upgrade package automatically, if there is a newer version.

  • desktop_package_conflicts (Boolean) (defaults to: false)

    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.

  • desktop_package_name (String[1]) (defaults to: 'open-vm-tools-desktop')

    Name of the desktop package. Only set this if your platform is not supported or you know what you are doing.

  • manage_epel (Boolean) (defaults to: false)

    Boolean that determines if puppet-epel is required for packages. This should only needed for RedHat (EL) 6.

  • package_name (String[1]) (defaults to: 'open-vm-tools')

    Name of the package. Only set this if your platform is not supported or you know what you are doing.

  • service_enable (Boolean) (defaults to: true)

    Start service at boot.

  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')

    Ensure if service is running or stopped.

  • service_hasstatus (Boolean) (defaults to: true)

    Service has status command. Only set this if your platform is not supported or you know what you are doing.

  • service_name (Variant[String[1],Array[String[1]]]) (defaults to: ['vgauthd', 'vmtoolsd'])

    Name of openvmtools service(s). Only set this if your platform is not supported or you know what you are doing.

  • service_pattern (Optional[String[1]]) (defaults to: undef)

    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.

  • supported (Optional[Boolean]) (defaults to: undef)

    Boolean that overrides the result of the supported OS check

  • uninstall_vmware_tools (Boolean) (defaults to: false)

    Boolean that determines whether the conflicting VMWare Tools package should be uninstalled, if present.

  • with_desktop (Boolean) (defaults to: false)

    Whether or not to install the desktop/GUI support.

Author:

  • Mike Arnold <mike@razorsedge.org>

  • Vox Pupuli <voxpupuli@groups.io>



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
# File 'manifests/init.pp', line 71

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,
  Optional[Boolean]                   $supported                 = undef,
  Boolean                             $uninstall_vmware_tools    = false,
  Boolean                             $with_desktop              = false,
) {
  if $facts['virtual'] == 'vmware' {
    if pick($supported, openvmtools::supported($module_name)) {
      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 = regsubst( $facts['vmware_uninstaller'],
            '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,
      }

      file { '/var/run/vmware':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
      }
      -> 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.
  }
}