-
Notifications
You must be signed in to change notification settings - Fork 144
VMware: govcsim
govcsim (vCenter Server Simulator)
Following page will provide guide to install and configure govcsim which is used in testing Ansible VMware modules.
This guide is helpful if you are -
- testing VMware module,
- writing a new VMware module,
- exploring VMware module for example,
You can go through already developed Ansible VMware test playbooks here.
govcsim (vCenter Server Simulator) is an open source vCenter Server and ESXi API based simulator written in go language using govmomi library. govcsim simulates vCenter Server model by creating various vCenter related objects e.g., datacenter, hosts, clusters, resource pools, networks and datastores etc.
Refer detailed steps from Official Golang Page
% export GOPATH=<your_go_path>
% go get -u github.com/vmware/govmomi/vcsim
% $GOPATH/bin/vcsim -h
If you see help page of govcsim, then you have successfully installed govcsim on your system.
Ansible VMware module communicates with govcsim through a Flask controller app.
% export ANSIBLE_SRC=<path_to_your_ansible_src_dir>
% cd $ANSIBLE_SRC/test/utils/docker/vcenter-simulator
% python flask_control.py
This will start a Flask instance which will serve on localhost with port 5000 by-default.
You can test this using,
% curl -k http://0.0.0.0:5000/
This command will return plain string vcsim controller
on stdout. This means your flask controller is working.
In order to start govcsim using Flask controller use following command,
% curl -k http://0.0.0.0:5000/spawn?username=user&password=pass&hostname=localhost&cluster=2&port=443
This will start a govcsim server with user
as username, pass
as password, localhost
as hostname and 443
as port. The newly created govcsim will have by-default values of all VMware objects and cluster values as 2
. You can configure these values as per your requirement.
If you want to kill govcsim and start new instance, then you can kill it using flask routes
- http://0.0.0.0:5000/kill/<process_id_of_govcsim_to_be_killed>
- http://0.0.0.0:5000/killall
- '/' - returns string
vcsim simulator
- '/kill/int:number' - kill particular instance of govcsim running on given system
- '/killall' - kill all instances of govcsim
- '/spawn' - spawn a new instance of govcsim
- '/govc_find' - find VMware objects using govc command
- '/govc_vm_info' - get details about Virtual Machine(s)
- '/govc_host_info' - get details about host system(s)
This Wiki is used for quick notes, not for support or documentation.
Working groups are now in the Ansible forum
Ansible project:
Community,
Contributor Experience,
Docs,
News,
Outreach,
RelEng,
Testing
Cloud:
AWS,
Azure,
CloudStack,
Container,
DigitalOcean,
Docker,
hcloud,
Kubernetes,
Linode,
OpenStack,
oVirt,
Virt,
VMware
Networking:
ACI,
AVI,
F5,
Meraki,
Network,
NXOS
Ansible Developer Tools:
Ansible-developer-tools
Software:
Crypto,
Foreman,
GDrive,
GitLab,
Grafana,
IPA,
JBoss,
MongoDB,
MySQL,
PostgreSQL,
RabbitMQ,
Zabbix
System:
AIX,
BSD,
HP-UX,
macOS,
Remote Management,
Solaris,
Windows
Security:
Security-Automation,
Lockdown
Tooling:
AWX,
Galaxy,
Molecule
Plugins:
httpapi