New in version 2015.5.4.
Author: Nitin Madhok <nmadhok@clemson.edu>
The VMware cloud module allows you to manage VMware ESX, ESXi, and vCenter.
The vmware module for Salt Cloud requires the pyVmomi
package, which is
available at PyPI:
https://pypi.python.org/pypi/pyvmomi
This package can be installed using pip or easy_install:
pip install pyvmomi
easy_install pyvmomi
Note
Version 6.0 of pyVmomi has some problems with SSL error handling on certain versions of Python. If using version 6.0 of pyVmomi, the machine that you are running the proxy minion process from must have either Python 2.7.9 or newer This is due to an upstream dependency in pyVmomi 6.0 that is not supported in Python version 2.6 to 2.7.8. If the version of Python running the salt-cloud command is not in the supported range, you will need to install an earlier version of pyVmomi. See Issue #29537 for more information.
The VMware cloud module needs the vCenter URL, username and password to be
set up in the cloud configuration at
/etc/salt/cloud.providers
or /etc/salt/cloud.providers.d/vmware.conf
:
my-vmware-config:
driver: vmware
user: 'DOMAIN\user'
password: 'verybadpass'
url: '10.20.30.40'
vcenter01:
driver: vmware
user: 'DOMAIN\user'
password: 'verybadpass'
url: 'vcenter01.domain.com'
protocol: 'https'
port: 443
vcenter02:
driver: vmware
user: 'DOMAIN\user'
password: 'verybadpass'
url: 'vcenter02.domain.com'
protocol: 'http'
port: 80
Note
Optionally, protocol
and port
can be specified if the vCenter
server is not using the defaults. Default is protocol: https
and
port: 443
.
Note
Changed in version 2015.8.0.
The provider
parameter in cloud provider definitions was renamed to driver
. This
change was made to avoid confusion with the provider
parameter that is used in cloud profile
definitions. Cloud provider definitions now use driver
to refer to the Salt cloud module that
provides the underlying functionality to connect to a cloud host, while cloud profiles continue
to use provider
to refer to provider configurations that you define.
Set up an initial profile at /etc/salt/cloud.profiles
or
/etc/salt/cloud.profiles.d/vmware.conf
:
vmware-centos6.5:
provider: vcenter01
clonefrom: test-vm
## Optional arguments
num_cpus: 4
memory: 8GB
devices:
cd:
CD/DVD drive 1:
device_type: datastore_iso_file
iso_path: "[nap004-1] vmimages/tools-isoimages/linux.iso"
CD/DVD drive 2:
device_type: client_device
mode: atapi
CD/DVD drive 3:
device_type: client_device
mode: passthrough
disk:
Hard disk 1:
size: 30
Hard disk 2:
size: 20
Hard disk 3:
size: 5
network:
Network adapter 1:
name: 10.20.30-400-Test
switch_type: standard
ip: 10.20.30.123
gateway: [10.20.30.110]
subnet_mask: 255.255.255.128
domain: example.com
Network adapter 2:
name: 10.30.40-500-Dev-DHCP
adapter_type: e1000
switch_type: distributed
Network adapter 3:
name: 10.40.50-600-Prod
adapter_type: vmxnet3
switch_type: distributed
ip: 10.40.50.123
gateway: [10.40.50.110]
subnet_mask: 255.255.255.128
domain: example.com
scsi:
SCSI controller 1:
type: lsilogic
SCSI controller 2:
type: lsilogic_sas
bus_sharing: virtual
SCSI controller 3:
type: paravirtual
bus_sharing: physical
domain: example.com
dns_servers:
- 123.127.255.240
- 123.127.255.241
- 123.127.255.242
# If cloning from template, either resourcepool or cluster MUST be specified!
resourcepool: Resources
cluster: Prod
datastore: HUGE-DATASTORE-Cluster
folder: Development
datacenter: DC1
host: c4212n-002.domain.com
template: False
power_on: True
extra_config:
mem.hotadd: 'yes'
guestinfo.foo: bar
guestinfo.domain: foobar.com
guestinfo.customVariable: customValue
deploy: True
private_key: /root/.ssh/mykey.pem
ssh_username: cloud-user
password: veryVeryBadPassword
minion:
master: 123.127.193.105
file_map:
/path/to/local/custom/script: /path/to/remote/script
/path/to/local/file: /path/to/remote/file
/srv/salt/yum/epel.repo: /etc/yum.repos.d/epel.repo
hardware_version: 10
provider
clonefrom
num_cpus
memory
memory: 8GB
or memory: 8192MB
.devices
Enter the device specifications here. Currently, the following devices can be created or reconfigured:
Enter the CD/DVD drive specification here. If the CD/DVD drive doesn't exist, it will be created with the specified configuration. If the CD/DVD drive already exists, it will be reconfigured with the specifications. The following options can be specified per CD/DVD drive:
client_device
and datastore_iso_file
. Default is
device_type: client_device
device_type: datastore_iso_file
. The syntax to specify this is
iso_path: "[datastoreName] vmimages/tools-isoimages/linux.iso"
. This
field is ignored if device_type: client_device
device_type: client_device
. Currently
supported modes are passthrough
and atapi
. This field is ignored if
device_type: datastore_iso_file
. Default is mode: passthrough
Enter the network adapter specification here. If the network adapter doesn't exist, a new network adapter will be created with the specified network name, type and other configuration. If the network adapter already exists, it will be reconfigured with the specifications. The following additional options can be specified per network adapter (See example above):
vmxnet
, vmxnet2
, vmxnet3
, e1000
and e1000e
.
If no type is specified, by default vmxnet3
will be used.standard
for standard portgroups and distributed
for
distributed virtual portgroups.Enter the SCSI adapter specification here. If the SCSI adapter doesn't exist, a new SCSI adapter will be created of the specified type. If the SCSI adapter already exists, it will be reconfigured with the specifications. The following additional options can be specified per SCSI adapter:
lsilogic
, lsilogic_sas
and paravirtual
. Type must
be specified when creating a new SCSI adapter.Specify this if sharing of virtual disks between virtual machines is desired. The following can be specified:
domain
domain
is set to the domain from the VM name. Default is local
.dns_servers
resourcepool
Enter the name of the resourcepool to which the new virtual machine should be attached. This determines what compute resources will be available to the clone.
Note
cluster
Enter the name of the cluster whose resource pool the new virtual machine should be attached to.
Note
datastore
Enter the name of the datastore or the datastore cluster where the virtual machine should be located on physical storage. If not specified, the current datastore is used.
Note
folder
Enter the name of the folder that will contain the new virtual machine.
Note
datacenter
Enter the name of the datacenter that will contain the new virtual machine.
Note
host
Enter the name of the target host where the virtual machine should be registered.
If not specified:
Note
template
template: False
.power_on
template: True
is set, this field is ignored. Default is power_on: True
.extra_config
deploy
True
so salt will be installed using the bootstrap script. If template: True
or
power_on: False
is set, this field is ignored and salt will not be installed.private_key
ssh_username
root
password
private_key
is
specified, you do not need to specify this.minion
master
as the IP/DNS name of the master.file_map
hardware_version
customization
customization: False
is set, the new virtual machine will not be customized.
Default is customization: True
.