Ubuntu – Installing open-vm-tools in Ubuntu via Puppet; what’s the lesser evil

package-managementpuppetUbuntuvmware-tools

In an ideal world, configuring puppet to install the open-vm-tools should be as simple as this:

class vm-tools {
    package { 'open-vm-tools':
        ensure => installed
    }
    package { 'open-vm-dkms':
        ensure => installed
    }
}

But, that opens up an ugly can of dependency creep; it installs X, which obviously doesn't belong on servers. As of Ubuntu 10.04, these packages both end up recommending the open-vm-toolbox package of GUI tools:

# apt-cache depends open-vm-dkms
open-vm-dkms
  Depends: dkms
  Depends: make
  Suggests: open-vm-toolbox
  Recommends: open-vm-tools

# apt-cache depends open-vm-tools
open-vm-tools
  Depends: libc6
  Depends: libfuse2
  Depends: libgcc1
  Depends: libglib2.0-0
  Depends: libicu44
  Depends: libstdc++6
  Recommends: open-vm-source
  Recommends: open-vm-toolbox
  Recommends: ethtool
  Recommends: zerofree

Recommended packages are always installed by default. It's clearly not desirable to install X dependencies by default when installing a package that is described as "CLI Tools".

The feature request against Debian was immediately rejected for this reason, but cooler heads did not prevail in Ubuntu. It seems that within the last week, there's some recognition that this was an ill-advised change, but that's of no help until the next LTS release rolls around.

The behavior to install recommended packages is easily enough disabled on the command line with the --no-install-recommends option, but through puppet there's no support for doing this, and a tangled mess of tickets requesting that support haven't gone far in 3 years.

The other option is to just disable recommended packages throughout the whole system via apt.conf, which is a massive change to package behavior with impacts reaching further than I'd like.

I've resigned myself to doing it the lazy way;

exec { 'open-vm-tools install':
    command => '/usr/bin/apt-get install -y --no-install-recommends open-vm-dkms open-vm-tools',
    creates => '/usr/lib/open-vm-tools',
}

But this is clearly "doing it wrong". Am I missing something that would make this all work the way it's supposed to, or is this the best hackish workaround to this issue?

Best Answer

Bug 1766 indicated that the aptitude provider installs recommended packages, while the apt provider does not.

If that's correct (I've not verified it myself), then the following may work more cleanly:

package { [ "open-vm-tools", "open-vm-dkms" ]:
  ensure   => installed,
  provider => apt,
}

Adapted from Puppet Type Reference, "package" section.


Edit after further investigation: since the apt provider is the default on Ubuntu and Debian, use the aptitude provider for these packages, and add a suitable ~/.aptitude/config for root.

package { [ "open-vm-tools", "open-vm-dkms" ]:
  ensure   => installed,
  provider => aptitude,
  require  => File["/root/.aptitude/config"];
}
file { "/root/.aptitude/config":
  ensure  => present,
  content => 'APT::Install-Recommends "0";';
}

Not perfect, but more concise than a giant exec line.