$FHHOME/fabfile/vmware.py
I use Fabric for simple tasks and repetitive tasks.
$ fab -l |grep -F vmware. $ H="test-vm1,test-vm2" $ fab -H $H auth.vmwarepro vmware.xxxx
$ ssh user01@xx.xx.xx.xx "vim-cmd vmsvc/getallvms"
$FHHOME/fabfile/vmware.py
import sys, os from fabric.api import * from fabric.contrib import files env.eagerly_disconnect = False FHHOME=os.environ["FHHOME"] #------------------------------------------------------------------ #vmware.get_system_version #------------------------------------------------------------------ @task def get_system_version(): """get esxi version""" run("esxcli system version get", shell=False) #------------------------------------------------------------------ #vmware.getallvms #------------------------------------------------------------------ @task @runs_once def get_allvms(): """ List VM Guest """ run("vim-cmd vmsvc/getallvms", shell=False)