Xshell Lab

2026-05-02 12:02:47

7 Proven Steps to Build and Deploy the Latest open-vm-tools with Ansible and Docker

Learn how to build and deploy the latest open-vm-tools from source using Docker and Ansible, beating distro package delays with automated compilation and deployment across Ubuntu, Debian, RHEL, Rocky, Fedora, and SUSE.

If you manage Linux VMs on VMware, you know the frustration: your distribution’s open-vm-tools package is often months or years behind upstream releases. This means missing out on critical guest OS compatibility fixes, VMCI socket support, and security patches that your distro hasn't backported. Fortunately, there’s a smarter approach—a purpose-built Ansible role called vmware-tools-builder that compiles the latest open-vm-tools inside isolated Docker containers, produces clean .deb and .rpm packages, and deploys them across your fleet with minimal hassle. In this article, we’ll walk through seven essential steps to set up this workflow, from understanding the core problem to automating updates across multiple distributions.

1. Understand Why Distro Packages Fall Short

Most enterprise Linux distributions prioritize stability over bleeding-edge updates, which is sensible for core system components—but it becomes a liability for VMware Tools. The distro version you get via apt or yum can be 1–2 years behind upstream, leaving you exposed to unpatched CVEs and lacking features like modern VMCI socket support (critical for high-performance inter‑VM communication). Even if VMware releases an urgent fix, you’re at the mercy of your distro’s backport schedule, which can take weeks or months. This gap matters most when you’re running newer ESXi versions that require updated guest drivers. By relying on the distro package, you’re trading convenience for outdated, potentially insecure software.

7 Proven Steps to Build and Deploy the Latest open-vm-tools with Ansible and Docker
Source: dev.to

2. The Builder Strategy: Why Compile from Source at All?

You might ask, “Why not just grab the tarball and compile manually?” That’s exactly what this approach does—but with automation and isolation. The vmware-tools-builder role compiles inside Docker containers so your Ansible controller and build host stay clean: no build dependencies clutter your system. The output is a set of native packages (.deb for Debian/Ubuntu, .rpm for RHEL/Fedora) that can be installed via standard package managers. This avoids the “dependency hell” of manual compilation and ensures every target machine gets a consistent, testable artifact. It’s the best of both worlds: upstream freshness with distribution‑grade packaging.

3. Set Up the Build Environment with Docker Containers

The build process is orchestrated by shell scripts inside the containers/ directory. The build-all.sh script determines which container images to run—one per target distribution (e.g., Ubuntu 22.04, Debian 12, Rocky Linux 9). You can optionally pin a specific upstream version (e.g., --version 12.5.0) or target a single distro with --target rocky9. The script builds open-vm-tools from the official GitHub source, applies distribution‑specific patches, and packages the result. All generated files land in output/ as .deb or .rpm files, which are automatically copied to the files/ directory—ready for Ansible to distribute. This isolation means you can build for multiple platforms simultaneously without cross‑contamination.

4. Deploy the Pre-Built Packages with Ansible

Once the packages are ready, deployment is a breeze. Install the role from Ansible Galaxy: ansible-galaxy install giuliosavini.vmware_tools_builder. Then write an inventory file that groups your hosts by OS family (e.g., [debian] and [rhel]). Run a simple playbook that includes the role with a few variables—like vmtools_remove_standard: true to purge any existing distro package before installing the custom build. The role handles all the heavy lifting: it detects the package manager, copies the correct .deb or .rpm from the controller’s files/ directory, installs or upgrades, and runs post‑install tasks (like starting the vmtoolsd service). No manual SSH commands or package manager gymnastics required.

7 Proven Steps to Build and Deploy the Latest open-vm-tools with Ansible and Docker
Source: dev.to

5. Smart Deployment Logic Handles Three Scenarios Automatically

The role isn’t a one‑trick pony—it intelligently adapts to the current state of each host. Scenario 1: No open-vm-tools installed → performs a fresh install of the custom build. Scenario 2: Distro’s open-vm-tools is present → removes it and replaces it with the custom version (no conflicts). Scenario 3: A previous custom build exists → performs an in‑place upgrade, preserving configuration files and ensuring a smooth transition. After deployment, the role runs a diagnostic suite that checks if vmtoolsd started successfully; if it fails, it collects logs and attempts automatic recovery (e.g., restarting the service or reinstalling the package). This safety net prevents broken VMs and reduces troubleshooting time.

6. Verify Supported Platforms and Cross‑Distro Compatibility

The role supports a wide range of operating systems. On the build side, Docker containers are provided for Ubuntu 22.04+, Debian 12+, RHEL/Rocky/Alma 8 and 9, and Fedora. For deployment, the role also extends to SUSE/openSUSE via zypper, though packages for those distributions must be built externally (or obtained from the upstream). This means you can maintain a single build pipeline for all your Linux VMs, regardless of the OS flavor. The role automatically selects the correct package manager (apt, yum, or zypper) and architecture, so no additional configuration is needed. Just ensure your Ansible controller has SSH access and that the target hosts are reachable.

7. Minimal Requirements and Easy Maintenance

You only need two things: Docker on the build host (just for compiling packages—it’s not needed on targets) and Ansible 2.12+ on the controller. No special agents, no separate package repositories, no complex CI/CD pipelines. Once set up, updating to a new upstream version is as simple as re‑running the build script with the desired version tag and re‑executing the playbook. The entire workflow is declarative: the playbook defines the desired state, and the role ensures it. For teams that manage hundreds of VMware VMs, this approach eliminates the drudgery of manual updates while keeping your infrastructure secure and compatible with the latest ESXi features.

Conclusion: By following these seven steps, you can take control of your open-vm-tools lifecycle—no more waiting for distro backports or wrestling with manual compilation. The combination of Docker‑based builds and Ansible automation gives you fresh, secure packages deployed consistently across your entire fleet. Start with the vmware-tools-builder role today and say goodbye to outdated VMware Tools.