This post is a long overdue tutorial on how to setup govc.
What is govc? It’s a cli utilizing govmomi, a go library used to interact with vSphere API. Why use govc? It’s fast and way better to use for automation tasks.
Installation:
- Download release binary here:
- Depending on the platform, decompress:
- gzip -d govc_linux_amd64.gz
- Flag it as executable
- chmod +x govc_linux_amd64
- Move the executable to your $PATH:
- mv govc_linux_amd64 /usr/local/bin/govc
How to use:
- Create a flat file with the below content
- source the file to export
- run govc
- sample: govc ls
export GOVC_URL=https://172.16.0.21
export [email protected]
export GOVC_PASSWORD=VMware1!
export GOVC_INSECURE=true
Advance examples here: