Ansible와 Docker를 사용하여 최신 open-vm-tools를 소스에서 빌드하고 배포하기
Source: Dev.to
이 역할을 사용하는 이유는?
Running Linux VMs on VMware often means the distro‑provided open‑vm‑tools package is 1–2 years behind upstream. That can cause:
| 기능 | 배포판 패키지 | 이 역할 |
|---|---|---|
| 버전 | 몇 개월/년 뒤 | 항상 최신 업스트림 |
| VMCI 소켓 지원 | 종종 누락 | 컴파일 포함 |
| CVE 패치 | 배포판 백포트에 의존 | 릴리스 시 업스트림 수정 |
| 다중 배포판 지원 | 한 번에 하나 | Ubuntu, Debian, RHEL, Rocky, Fedora, SUSE 등 |
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.
패키지 빌드
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.
역할 설치
ansible-galaxy install giuliosavini.vmware_tools_builder
인벤토리 예시
[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
플레이북 실행
ansible-playbook -i inventory.ini playbook.yml
역할 동작
The role automatically handles three scenarios—no conditional variables required:
| 현재 상태 | 동작 |
|---|---|
| open‑vm‑tools가 설치되지 않음 | 새로 설치 |
| 배포판 open‑vm‑tools 존재 | 제거하고 커스텀 빌드 설치 |
| 이전 커스텀 빌드 존재 | 제자리 업그레이드 |
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.
지원되는 배포판
| 배포판 | 빌드 방법 | 배포 방법 |
|---|---|---|
| Ubuntu 22.04+ | Docker 컨테이너 | Ansible (apt) |
| Debian 12+ | Docker 컨테이너 | Ansible (apt) |
| RHEL / Rocky / Alma 9 | Docker 컨테이너 | Ansible (yum) |
| RHEL / Rocky / Alma 8 | Docker 컨테이너 | Ansible (yum) |
| Fedora | Docker 컨테이너 | Ansible (yum) |
| SUSE / openSUSE | — | Ansible (zypper) |
예시 플레이북
- 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
요구 사항
- 빌드 호스트에 Docker (패키지 컴파일에만 필요)
- 컨트롤러에 Ansible 2.12+
- 대상 머신에 대한 SSH 접근
No special build dependencies or polluted environments are needed.
결론
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: