salt.cloud.clouds.vsphere

vSphere Cloud Module

New in version 2014.7.0.

The vSphere cloud module is used to control access to VMWare vSphere.

depends:
  • PySphere Python module >= 0.1.8

Note: Ensure python pysphere module is installed by running following one-liner check. The output should be 0.

python -c "import pysphere" ; echo $?
# if this fails install using
pip install https://pysphere.googlecode.com/files/pysphere-0.1.8.zip

Use of this module only requires a URL, username and password. Set up the cloud configuration at:

/etc/salt/cloud.providers or /etc/salt/cloud.providers.d/vsphere.conf:

my-vsphere-config:
  provider: vsphere
  user: myuser
  password: verybadpass
  url: 'https://10.1.1.1:443'

Note: Your URL may or may not look like any of the following, depending on how your VMWare installation is configured:

10.1.1.1
10.1.1.1:443
https://10.1.1.1:443
https://10.1.1.1:443/sdk
10.1.1.1:443/sdk
folder: Name of the folder that will contain the new VM. If not set, the VM will
be added to the folder the original VM belongs to.
resourcepool: MOR of the resourcepool to be used for the new vm. If not set, it
uses the same resourcepool than the original vm.
datastore: MOR of the datastore where the virtual machine should be located. If
not specified, the current datastore is used.
host: MOR of the host where the virtual machine should be registered.
IF not specified:
  • if resourcepool is not specified, current host is used.
  • if resourcepool is specified, and the target pool represents a stand-alone host, the host is used.
  • if resourcepool is specified, and the target pool represents a DRS-enabled cluster, a host selected by DRS is used.
  • if resourcepool is specified and the target pool represents a cluster without DRS enabled, an InvalidArgument exception will be thrown.
template: Specifies whether or not the new virtual machine should be marked as a
template. Default is False.
salt.cloud.clouds.vsphere.avail_images()

Return a dict of all available VM images on the cloud provider.

salt.cloud.clouds.vsphere.avail_locations()

Return a dict of all available VM locations on the cloud provider with relevant data

salt.cloud.clouds.vsphere.create(vm_)

Create a single VM from a data dict

salt.cloud.clouds.vsphere.create_snapshot(kwargs=None, call=None)

Create a snapshot

@name: Name of the virtual machine to snapshot @snapshot: Name of the snapshot @description: Description of the snapshot (optional) @memory: Dump of the internal state of the virtual machine (optional)

New in version Beryllium.

CLI Example:

salt-cloud -f create_snapshot [PROVIDER] name=myvm.example.com snapshot=mysnapshot
salt-cloud -f create_snapshot [PROVIDER] name=myvm.example.com snapshot=mysnapshot description='My Snapshot' memory=True
salt.cloud.clouds.vsphere.delete_snapshot(kwargs=None, call=None)

Delete snapshot

New in version Beryllium.

CLI Example:

salt-cloud -f delete_snapshot [PROVIDER] name=myvm.example.com snapshot=mysnapshot
salt.cloud.clouds.vsphere.destroy(name, call=None)

Destroy a node.

CLI Example:

salt-cloud --destroy mymachine
salt.cloud.clouds.vsphere.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.vsphere.get_conn()

Return a conn object for the passed VM data

salt.cloud.clouds.vsphere.list_clusters(kwargs=None, call=None)

List the clusters for this VMware environment

salt.cloud.clouds.vsphere.list_datacenters(kwargs=None, call=None)

List the data centers for this VMware environment

salt.cloud.clouds.vsphere.list_datastores(kwargs=None, call=None)

List the datastores for this VMware environment

salt.cloud.clouds.vsphere.list_folders(kwargs=None, call=None)

List the folders for this VMWare environment

salt.cloud.clouds.vsphere.list_hosts(kwargs=None, call=None)

List the hosts for this VMware environment

salt.cloud.clouds.vsphere.list_nodes(kwargs=None, call=None)

Return a list of the VMs that are on the provider, with basic fields

salt.cloud.clouds.vsphere.list_nodes_full(kwargs=None, call=None)

Return a list of the VMs that are on the provider with full details

salt.cloud.clouds.vsphere.list_nodes_min(kwargs=None, call=None)

Return a list of the nodes in the provider, with no details

salt.cloud.clouds.vsphere.list_nodes_select()

Return a list of the VMs that are on the provider, with select fields

salt.cloud.clouds.vsphere.list_resourcepools(kwargs=None, call=None)

List the hosts for this VMware environment

salt.cloud.clouds.vsphere.reset(name, call=None)

To reset a VM using its name

CLI Example:

salt-cloud -a reset vmname
salt.cloud.clouds.vsphere.script(vm_)

Return the script deployment object

salt.cloud.clouds.vsphere.show_instance(name, call=None)

Show the details from vSphere concerning a guest

salt.cloud.clouds.vsphere.snapshot_list(kwargs=None, call=None)

List virtual machines with snapshots

New in version Beryllium.

CLI Example:

salt-cloud -f snapshot_list
salt.cloud.clouds.vsphere.start(name, call=None)

To start/power on a VM using its name

CLI Example:

salt-cloud -a start vmname
salt.cloud.clouds.vsphere.status(name, call=None)

To check the status of a VM using its name

CLI Example:

salt-cloud -a status vmname
salt.cloud.clouds.vsphere.stop(name, call=None)

To stop/power off a VM using its name

CLI Example:

salt-cloud -a stop vmname
salt.cloud.clouds.vsphere.suspend(name, call=None)

To suspend a VM using its name

CLI Example:

salt-cloud -a suspend vmname
salt.cloud.clouds.vsphere.wait_for_ip(vm_)