Build and deploy the latest open-vm-tools from source with Ansible and Docker
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:
| Feature | Distro package | This role |
|---|---|---|
| Version | Months/years behind | Always latest upstream |
| VMCI socket support | Often missing | Compiled in |
| CVE patches | Depends on distro backport | Upstream fix on release |
| Multi‑distro support | One at a time | Ubuntu, 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 state | Action |
|---|---|
| No open‑vm‑tools installed | Fresh install |
| Distro open‑vm‑tools present | Remove it, install custom build |
| Previous custom build present | In‑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
| Distro | Build method | Deploy method |
|---|---|---|
| Ubuntu 22.04+ | Docker container | Ansible (apt) |
| Debian 12+ | Docker container | Ansible (apt) |
| RHEL / Rocky / Alma 9 | Docker container | Ansible (yum) |
| RHEL / Rocky / Alma 8 | Docker container | Ansible (yum) |
| Fedora | Docker container | Ansible (yum) |
| SUSE / openSUSE | — | Ansible (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: