FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

os:vmware:index.html



Top#OS

VMware vSphere Hypervisor (ESXi) (vmware.py)

$FHHOME/fabfile/vmware.py



I use Fabric for simple tasks and repetitive tasks.

Fabric Operation

$ fab  -l |grep -F vmware.

$ H="test-vm1,test-vm2"
$ fab -H $H  auth.vmwarepro  vmware.xxxx


How to Check to Use Fabric in VMware

$ ssh user01@xx.xx.xx.xx "vim-cmd vmsvc/getallvms"


vmware.py

$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)


Top#Hardware





Top#Hardware



os/vmware/index.html.txt ยท Last modified: 2018/02/22 23:55 by kurihara