2015-04-05 20:46:48 +00:00
|
|
|
===========================
|
|
|
|
Getting Started With VMware
|
|
|
|
===========================
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-04 21:25:27 +00:00
|
|
|
.. versionadded:: Beryllium
|
|
|
|
|
|
|
|
**Author**: Nitin Madhok <nmadhok@clemson.edu>
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
The VMware cloud module allows you to manage VMware ESX, ESXi, and vCenter.
|
|
|
|
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
Dependencies
|
|
|
|
============
|
2015-03-31 18:25:53 +00:00
|
|
|
The vmware module for Salt Cloud requires the ``pyVmomi`` package, which is
|
2015-03-31 16:06:20 +00:00
|
|
|
available at PyPI:
|
|
|
|
|
|
|
|
https://pypi.python.org/pypi/pyvmomi
|
|
|
|
|
|
|
|
This package can be installed using `pip` or `easy_install`:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
pip install pyvmomi
|
|
|
|
easy_install pyvmomi
|
|
|
|
|
|
|
|
|
|
|
|
Configuration
|
|
|
|
=============
|
|
|
|
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``:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
my-vmware-config:
|
|
|
|
provider: vmware
|
2015-05-06 23:01:42 +00:00
|
|
|
user: "DOMAIN\user"
|
|
|
|
password: "verybadpass"
|
|
|
|
url: "vcenter01.domain.com"
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
vmware-vcenter02:
|
|
|
|
provider: vmware
|
2015-05-06 23:01:42 +00:00
|
|
|
user: "DOMAIN\user"
|
|
|
|
password: "verybadpass"
|
|
|
|
url: "vcenter02.domain.com"
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
vmware-vcenter03:
|
|
|
|
provider: vmware
|
2015-05-06 23:01:42 +00:00
|
|
|
user: "DOMAIN\user"
|
|
|
|
password: "verybadpass"
|
|
|
|
url: "vcenter03.domain.com"
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
.. _vmware-cloud-profile:
|
|
|
|
|
2015-03-31 16:06:20 +00:00
|
|
|
Profiles
|
|
|
|
========
|
|
|
|
Set up an initial profile at ``/etc/salt/cloud.profiles`` or
|
2015-03-31 18:25:53 +00:00
|
|
|
``/etc/salt/cloud.profiles.d/vmware.conf``:
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
vmware-centos6.5:
|
|
|
|
provider: vmware-vcenter01
|
|
|
|
clonefrom: test-vm
|
2015-04-03 20:03:52 +00:00
|
|
|
|
2015-03-31 16:06:20 +00:00
|
|
|
## Optional arguments
|
2015-04-01 09:54:52 +00:00
|
|
|
num_cpus: 4
|
|
|
|
memory: 8192
|
2015-04-05 20:46:48 +00:00
|
|
|
devices:
|
2015-05-06 21:32:03 +00:00
|
|
|
cd:
|
|
|
|
CD/DVD drive 1:
|
|
|
|
device_type: datastore_iso_file
|
2015-05-06 22:52:44 +00:00
|
|
|
iso_path: "[nap004-1] vmimages/tools-isoimages/linux.iso"
|
2015-05-06 21:32:03 +00:00
|
|
|
CD/DVD drive 2:
|
|
|
|
device_type: client_device
|
|
|
|
mode: atapi
|
|
|
|
CD/DVD drive 3:
|
|
|
|
device_type: client_device
|
|
|
|
mode: passthrough
|
2015-04-05 20:46:48 +00:00
|
|
|
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
|
2015-05-01 01:34:31 +00:00
|
|
|
switch_type: standard
|
2015-04-10 21:39:30 +00:00
|
|
|
ip: 10.20.30.123
|
|
|
|
gateway: [10.20.30.110]
|
|
|
|
subnet_mask: 255.255.255.128
|
|
|
|
domain: mycompany.com
|
2015-04-05 20:46:48 +00:00
|
|
|
Network adapter 2:
|
|
|
|
name: 10.30.40-500-Dev-DHCP
|
2015-05-01 01:34:31 +00:00
|
|
|
adapter_type: e1000
|
|
|
|
switch_type: distributed
|
2015-04-05 20:46:48 +00:00
|
|
|
Network adapter 3:
|
|
|
|
name: 10.40.50-600-Prod
|
2015-05-01 01:34:31 +00:00
|
|
|
adapter_type: vmxnet3
|
2015-05-03 20:14:07 +00:00
|
|
|
switch_type: distributed
|
2015-04-10 21:39:30 +00:00
|
|
|
ip: 10.40.50.123
|
|
|
|
gateway: [10.40.50.110]
|
|
|
|
subnet_mask: 255.255.255.128
|
|
|
|
domain: mycompany.com
|
2015-04-18 21:09:11 +00:00
|
|
|
scsi:
|
|
|
|
SCSI controller 1:
|
|
|
|
type: lsilogic
|
|
|
|
SCSI controller 2:
|
|
|
|
type: lsilogic_sas
|
|
|
|
bus_sharing: virtual
|
|
|
|
SCSI controller 3:
|
|
|
|
type: paravirtual
|
|
|
|
bus_sharing: physical
|
2015-04-10 21:39:30 +00:00
|
|
|
|
|
|
|
domain: mycompany.com
|
|
|
|
dns_servers:
|
|
|
|
- 123.127.255.240
|
|
|
|
- 123.127.255.241
|
|
|
|
- 123.127.255.242
|
2015-04-03 20:03:52 +00:00
|
|
|
|
|
|
|
# If cloning from template, either resourcepool or cluster MUST be specified!
|
2015-04-01 18:42:58 +00:00
|
|
|
resourcepool: Resources
|
|
|
|
cluster: Prod
|
2015-04-03 20:03:52 +00:00
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
datastore: HUGE-DATASTORE-Cluster
|
2015-03-31 16:06:20 +00:00
|
|
|
folder: Development
|
2015-04-01 18:42:58 +00:00
|
|
|
datacenter: DC1
|
2015-03-31 16:06:20 +00:00
|
|
|
host: c4212n-002.domain.com
|
|
|
|
template: False
|
|
|
|
power_on: True
|
2015-04-06 21:52:47 +00:00
|
|
|
extra_config:
|
2015-04-06 22:04:53 +00:00
|
|
|
mem.hotadd: 'yes'
|
2015-05-03 20:14:07 +00:00
|
|
|
guestinfo.foo: bar
|
2015-04-06 22:04:53 +00:00
|
|
|
guestinfo.domain: foobar.com
|
2015-05-03 20:14:07 +00:00
|
|
|
guestinfo.customVariable: customValue
|
2015-04-10 21:39:30 +00:00
|
|
|
|
|
|
|
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
|
2015-03-31 16:06:20 +00:00
|
|
|
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``provider``
|
2015-03-31 18:25:53 +00:00
|
|
|
Enter the name that was specified when the cloud provider config was created.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``clonefrom``
|
2015-04-02 10:56:49 +00:00
|
|
|
Enter the name of the VM/template to clone from.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``num_cpus``
|
2015-04-05 20:46:48 +00:00
|
|
|
Enter the number of vCPUS you want the VM/template to have. If not specified,
|
|
|
|
the current VM/template\'s vCPU count is used.
|
2015-04-01 09:54:52 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``memory``
|
2015-04-05 20:46:48 +00:00
|
|
|
Enter memory (in MB) you want the VM/template to have. If not specified, the
|
|
|
|
current VM/template\'s memory size is used.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``devices``
|
2015-04-05 20:46:48 +00:00
|
|
|
Enter the device specifications here. Currently, the following devices can be
|
|
|
|
created or reconfigured:
|
|
|
|
|
2015-05-06 21:32:03 +00:00
|
|
|
cd
|
|
|
|
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:
|
|
|
|
|
|
|
|
device_type
|
|
|
|
Specify how the CD/DVD drive should be used. Currently supported types are
|
|
|
|
``client_device`` and ``datastore_iso_file``. Default is
|
|
|
|
``device_type: client_device``
|
|
|
|
iso_path
|
|
|
|
Enter the path to the iso file present on the datastore only if
|
|
|
|
``device_type: datastore_iso_file``. The syntax to specify this is
|
2015-05-06 22:52:44 +00:00
|
|
|
``iso_path: "[datastoreName] vmimages/tools-isoimages/linux.iso"``. This
|
2015-05-06 21:32:03 +00:00
|
|
|
field is ignored if ``device_type: client_device``
|
|
|
|
mode
|
|
|
|
Enter the mode of connection only if ``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``
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
disk
|
|
|
|
Enter the disk specification here. If the hard disk doesn\'t exist, it will
|
|
|
|
be created with the provided size. If the hard disk already exists, it will
|
|
|
|
be expanded if the provided size is greater than the current size of the disk.
|
|
|
|
|
|
|
|
network
|
|
|
|
Enter the network adapter specification here. If the network adapter doesn\'t
|
2015-04-10 21:39:30 +00:00
|
|
|
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
|
2015-05-03 20:14:07 +00:00
|
|
|
be reconfigured with the specifications. The following additional options can
|
|
|
|
be specified per network adapter (See example above):
|
2015-04-10 21:39:30 +00:00
|
|
|
|
|
|
|
name
|
|
|
|
Enter the network name you want the network adapter to be mapped to.
|
|
|
|
|
2015-05-01 01:34:31 +00:00
|
|
|
adapter_type
|
2015-04-18 21:09:11 +00:00
|
|
|
Enter the network adapter type you want to create. Currently supported
|
2015-05-03 20:14:07 +00:00
|
|
|
types are ``vmxnet``, ``vmxnet2``, ``vmxnet3``, ``e1000`` and ``e1000e``.
|
|
|
|
If no type is specified, by default ``vmxnet3`` will be used.
|
2015-04-10 21:39:30 +00:00
|
|
|
|
2015-05-01 01:34:31 +00:00
|
|
|
switch_type
|
|
|
|
Enter the type of switch to use. This decides whether to use a standard
|
|
|
|
switch network or a distributed virtual portgroup. Currently supported
|
2015-05-03 20:14:07 +00:00
|
|
|
types are ``standard`` for standard portgroups and ``distributed`` for
|
|
|
|
distributed virtual portgroups.
|
2015-05-01 01:34:31 +00:00
|
|
|
|
2015-04-10 21:39:30 +00:00
|
|
|
ip
|
|
|
|
Enter the static IP you want the network adapter to be mapped to. If the
|
|
|
|
network specified is DHCP enabled, you do not have to specify this.
|
|
|
|
|
|
|
|
gateway
|
|
|
|
Enter the gateway for the network as a list. If the network specified
|
|
|
|
is DHCP enabled, you do not have to specify this.
|
|
|
|
|
|
|
|
subnet_mask
|
|
|
|
Enter the subnet mask for the network. If the network specified is DHCP
|
|
|
|
enabled, you do not have to specify this.
|
|
|
|
|
|
|
|
domain
|
|
|
|
Enter the domain to be used with the network adapter. If the network
|
|
|
|
specified is DHCP enabled, you do not have to specify this.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
scsi
|
|
|
|
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
|
2015-05-03 20:14:07 +00:00
|
|
|
already exists, it will be reconfigured with the specifications. The following
|
|
|
|
additional options can be specified per SCSI adapter:
|
2015-04-18 21:09:11 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
Enter the SCSI adapter type you want to create. Currently supported
|
2015-05-03 20:14:07 +00:00
|
|
|
types are ``lsilogic``, ``lsilogic_sas`` and ``paravirtual``. Type must
|
|
|
|
be specified when creating a new SCSI adapter.
|
2015-04-18 21:09:11 +00:00
|
|
|
|
|
|
|
bus_sharing
|
|
|
|
Specify this if sharing of virtual disks between virtual machines is desired.
|
|
|
|
The following can be specified:
|
|
|
|
|
|
|
|
virtual
|
|
|
|
Virtual disks can be shared between virtual machines on the same server.
|
|
|
|
|
|
|
|
physical
|
|
|
|
Virtual disks can be shared between virtual machines on any server.
|
|
|
|
|
|
|
|
no
|
|
|
|
Virtual disks cannot be shared between virtual machines.
|
|
|
|
|
|
|
|
``domain``
|
2015-05-03 20:14:07 +00:00
|
|
|
Enter the global domain name to be used for DNS. If not specified and if the VM name
|
|
|
|
is a FQDN, ``domain`` is set to the domain from the VM name. Default is ``local``.
|
2015-04-10 21:39:30 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``dns_servers``
|
2015-04-10 21:39:30 +00:00
|
|
|
Enter the list of DNS servers to use in order of priority.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``resourcepool``
|
2015-03-31 18:25:53 +00:00
|
|
|
Enter the name of the resourcepool to which the new virtual machine should be
|
2015-04-02 10:56:49 +00:00
|
|
|
attached. This determines what compute resources will be available to the clone.
|
2015-04-02 10:28:32 +00:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
- For a clone operation from a virtual machine, it will use the same
|
|
|
|
resourcepool as the original virtual machine unless specified.
|
|
|
|
- For a clone operation from a template to a virtual machine, specifying
|
|
|
|
either this or cluster is required. If both are specified, the resourcepool
|
|
|
|
value will be used.
|
2015-04-02 10:28:32 +00:00
|
|
|
- For a clone operation to a template, this argument is ignored.
|
2015-04-01 18:42:58 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``cluster``
|
2015-04-05 20:46:48 +00:00
|
|
|
Enter the name of the cluster whose resource pool the new virtual machine should
|
|
|
|
be attached to.
|
2015-04-02 10:28:32 +00:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
- For a clone operation from a virtual machine, it will use the same cluster\'s
|
|
|
|
resourcepool as the original virtual machine unless specified.
|
|
|
|
- For a clone operation from a template to a virtual machine, specifying either
|
2015-04-05 20:46:48 +00:00
|
|
|
this or resourcepool is required. If both are specified, the resourcepool
|
|
|
|
value will be used.
|
2015-04-02 10:28:32 +00:00
|
|
|
- For a clone operation to a template, this argument is ignored.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``datastore``
|
2015-04-05 20:46:48 +00:00
|
|
|
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::
|
|
|
|
|
|
|
|
- If you specify a datastore cluster name, DRS Storage recommendation is
|
|
|
|
automatically applied.
|
|
|
|
- If you specify a datastore name, DRS Storage recommendation is disabled.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``folder``
|
2015-04-01 18:42:58 +00:00
|
|
|
Enter the name of the folder that will contain the new virtual machine.
|
2015-04-02 10:28:32 +00:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
- For a clone operation from a VM/template, the new VM/template will be added
|
|
|
|
to the same folder that the original VM/template belongs to unless specified.
|
2015-04-02 10:28:32 +00:00
|
|
|
- If both folder and datacenter are specified, the folder value will be used.
|
2015-04-01 18:42:58 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``datacenter``
|
2015-04-01 18:42:58 +00:00
|
|
|
Enter the name of the datacenter that will contain the new virtual machine.
|
2015-04-02 10:28:32 +00:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2015-04-05 20:46:48 +00:00
|
|
|
- For a clone operation from a VM/template, the new VM/template will be added
|
|
|
|
to the same folder that the original VM/template belongs to unless specified.
|
2015-04-02 10:28:32 +00:00
|
|
|
- If both folder and datacenter are specified, the folder value will be used.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``host``
|
2015-04-02 10:56:49 +00:00
|
|
|
Enter the name of the target host where the virtual machine should be registered.
|
2015-04-02 10:28:32 +00:00
|
|
|
|
2015-03-31 18:25:53 +00:00
|
|
|
If not specified:
|
|
|
|
|
2015-04-02 10:28:32 +00:00
|
|
|
.. note::
|
2015-03-31 18:25:53 +00:00
|
|
|
|
2015-04-02 10:28:32 +00:00
|
|
|
- If resource pool is not specified, current host is used.
|
|
|
|
- If resource pool is specified, and the target pool represents a stand-alone
|
2015-03-31 18:25:53 +00:00
|
|
|
host, the host is used.
|
2015-04-02 10:28:32 +00:00
|
|
|
- If resource pool is specified, and the target pool represents a DRS-enabled
|
2015-03-31 18:25:53 +00:00
|
|
|
cluster, a host selected by DRS is used.
|
2015-04-02 10:28:32 +00:00
|
|
|
- If resource pool is specified and the target pool represents a cluster without
|
2015-03-31 18:25:53 +00:00
|
|
|
DRS enabled, an InvalidArgument exception be thrown.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``template``
|
2015-03-31 18:25:53 +00:00
|
|
|
Specifies whether the new virtual machine should be marked as a template or not.
|
2015-04-02 10:28:32 +00:00
|
|
|
Default is ``template: False``.
|
2015-03-31 16:06:20 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``power_on``
|
2015-04-05 20:46:48 +00:00
|
|
|
Specifies whether the new virtual machine should be powered on or not. If
|
|
|
|
``template: True`` is set, this field is ignored. Default is ``power_on: True``.
|
2015-04-06 21:52:47 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``extra_config``
|
2015-04-06 21:52:47 +00:00
|
|
|
Specifies the additional configuration information for the virtual machine. This
|
|
|
|
describes a set of modifications to the additional options. If the key is already
|
|
|
|
present, it will be reset with the new value provided. Otherwise, a new option is
|
|
|
|
added. Keys with empty values will be removed.
|
2015-04-10 21:39:30 +00:00
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``deploy``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specifies if salt should be installed on the newly created VM. Default is ``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.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``private_key``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specify the path to the private key to use to be able to ssh to the VM.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``ssh_username``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specify the username to use in order to ssh to the VM. Default is ``root``
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``password``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specify a password to use in order to ssh to the VM. If ``private_key`` is
|
|
|
|
specified, you do not need to specify this.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``minion``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specify custom minion configuration you want the salt minion to have. A good example
|
|
|
|
would be to specify the ``master`` as the IP/DNS name of the master.
|
|
|
|
|
2015-04-18 21:09:11 +00:00
|
|
|
``file_map``
|
2015-04-10 21:39:30 +00:00
|
|
|
Specify file/files you want to copy to the VM before the bootstrap script is run
|
|
|
|
and salt is installed. A good example of using this would be if you need to put
|
|
|
|
custom repo files on the server in case your server will be in a private network
|
|
|
|
and cannot reach external networks.
|