vcenter adapter¶
Inmanta module to manage Vcenter and Esxi
Features¶
Handling connection to vCenter and ESXI using:
WS API (responsible for almost all operations)
REST API (responsible for tagging)
For both kinds SSL is supported.
Create, Read, Update, Delete of Distributed Virtual PortGroup
Read, Update, Delete of Virtual Machine (in general)
Create of Virtual Machine by cloning from template
Create of Virtual Machine by deploying OVA file (downloaded from webserver and uploaded to vCenter)
Create, Read, Update, Delete of Virtual Disk (supported managers: SCSI, IDE) with attachment to Virtual Machine
Create, Read, Update, Delete of Virtual Machine Port with attachment to Virtual Machine and IP address configuration
Usage example¶
This simple example shows how to deploy a virtual machine from an existing template on vcenter.
import vcenter
vc = vcenter::VCenter(
name="My Vcenter",
host="vcenter.example.com",
port=443,
credentials=vcenter::Credentials(
username_env_variable="VCENTER_USER",
password_env_variable="VCENTER_PASSWORD"
),
)
dc = vcenter::DataCenter(
parent=vc.root,
name="mydc"
)
vm = vcenter::VirtualMachineFromTemplate(
parent=dc.vm,
name="test_virtual_machine",
template_path="/mydc/vm/CentOS7Template",
datastore_path="/mydc/datastore/DatastoreCluster/datastore1",
resource_pool_path="/mydc/host/lab/Resources",
memory_mb=2048,
cpu_num=2,
cpu_num_per_socket=2,
power_on=true,
guest_os = vcenter::LinuxGuestOS(
hostname="localhost",
domain="domain.local"
),
children = [
vcenter::VirtualMachinePort(
name="eth0",
ip_address="192.168.1.2",
network_mask="255.255.255.0",
gateway="192.168.1.1",
distributed_virtual_portgroup_path="/mydc/network/test_network",
)
]
)