Build and deploy the latest open-vm-tools from source with Ansible and Docker

Published: (May 2, 2026 at 07:21 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Why use this role?

Running Linux VMs on VMware often means the distro‑provided open‑vm‑tools package is 1–2 years behind upstream. That can cause:

FeatureDistro packageThis role
VersionMonths/years behindAlways latest upstream
VMCI socket supportOften missingCompiled in
CVE patchesDepends on distro backportUpstream fix on release
Multi‑distro supportOne at a timeUbuntu, Debian, RHEL, Rocky, Fedora, SUSE, etc.

The role builds the latest open‑vm‑tools inside isolated Docker containers, produces clean .deb/.rpm packages, and deploys them across your fleet without polluting the Ansible controller.

Building the packages

The build runs in Docker containers—one per distro—so your host stays clean.

# Build for all supported distros
./build-all.sh

# Build for a single distro (e.g., Rocky 9)
./build-all.sh --target rocky9

# Pin a specific upstream version
./build-all.sh --version 12.5.0

The output (.deb and .rpm) is placed in output/ and automatically copied to files/ where Ansible can pick them up.

Installing the role

ansible-galaxy install giuliosavini.vmware_tools_builder

Inventory example

[debian]
srv-web01 ansible_host=10.0.0.1
srv-web02 ansible_host=10.0.0.2

[rhel]
srv-app01 ansible_host=10.0.0.10

[all:vars]
ansible_user=root

Running the playbook

ansible-playbook -i inventory.ini playbook.yml

Role behavior

The role automatically handles three scenarios—no conditional variables required:

Current stateAction
No open‑vm‑tools installedFresh install
Distro open‑vm‑tools presentRemove it, install custom build
Previous custom build presentIn‑place upgrade

For each host the role runs preflight → deploy → post‑install → diagnose → verify. If vmtoolsd fails to start, logs are collected and an automatic recovery attempt is made before reporting failure.

Supported distributions

DistroBuild methodDeploy method
Ubuntu 22.04+Docker containerAnsible (apt)
Debian 12+Docker containerAnsible (apt)
RHEL / Rocky / Alma 9Docker containerAnsible (yum)
RHEL / Rocky / Alma 8Docker containerAnsible (yum)
FedoraDocker containerAnsible (yum)
SUSE / openSUSEAnsible (zypper)

Example playbook

- name: Deploy custom open-vm-tools
  hosts: all
  become: true
  gather_facts: true
  roles:
    - role: giuliosavini.vmware_tools_builder
      vmtools_remove_standard: true
      vmtools_diagnose_on_failure: true

Requirements

  • Docker on the build host (only for compiling packages)
  • Ansible 2.12+ on the controller
  • SSH access to target machines

No special build dependencies or polluted environments are needed.

Conclusion

If you manage VMware infrastructure and are tired of outdated guest tools, give this role a try. The role is available on Ansible Galaxy and the source code is hosted on GitHub.

  • GitHub:
  • Ansible Galaxy:
0 views
Back to Blog

Related posts

Read more »