vSphere Plugin
Get the latest docs
You are looking at documentation for an older release. Not what you want? Go to the current release documentation.
Description
The vSphere plugin allows users to use a vSphere based infrastructure for deploying services and applications.
Plugin Requirements
- Python versions:
- 2.7.x
- Permissions on vCenter:
- To create and destroy virtual machines and storage:
- On the datacenter:
- Datastore/Allocate Space
- Network/Assign Network
- Virtual Machine/Configuration/Add or remove device
- Virtual Machine/Configuration/Change CPU count
- Virtual Machine/Configuration/Memory
- Virtual Machine/Interaction/Power On
- Virtual Machine/Inventory/Create from existing
- On the specific resource pool:
- Full permissions recommended
- On the template(s) to be used
- Virtual Machine/Provisioning/Customize
- Virtual Machine/Provisioning/Deploy template
- On the datacenter:
- To create and destroy port groups:
- On the datacenter:
- Host/Configuration/Network configuration
- On the datacenter:
- To create and destroy distributed port groups:
- On the datacenter:
- dvPort group/Create
- dvPort group/Delete
- On the datacenter:
- To create and destroy virtual machines and storage:
vSphere Environment
- You will require a working vSphere environment. The plugin was tested with version 5.5.
SSH Keys
- You will need SSH keys generated for both the manager and the application VM’s. If you are using the default key locations in the inputs, these can be created with the following commands:
ssh-keygen -b2048 -N "" -q -f ~/.ssh/cloudify-manager-kp.pem
ssh-keygen -b2048 -N "" -q -f ~/.ssh/cloudify-agent-kp.pem
OS Templates
- You need two OS templates of your preferred operating systems (e.g. Ubuntu Trusty) within the vSphere datastores. One for the Cloudify manager and one for the application VMs. The application VM template should accept the Cloudify agent public key for its root user. The Cloudify manager template must accept the cloudify manager public key. Note that you can choose to use same template for both the manager and the application VMs, in that case the shared template must accept both public keys.
- Both templates must have SSH activated and open on the firewall.
- Both templates must have VMWare tools installed. Instructions for this can be found on the VMWare site. Please note, however, that the instructions on this site give incorrect tools for importing keys (it should be using
rpm --import <key>rather than the apt-key equivalent). After following the instructions you should also run:chkconfig vmtoolsd on. - It is also necessary to install the deployPkg plugin on the VM according to VMWare documentation
- The template should not have any network interfaces.
Types
Tip
Each type has property connection_config. It can be used to pass parameters for authenticating. Overriding of this property is not required, and by default the authentication will take place with the same credentials that were used for the Cloudify bootstrap process.
cloudify.vsphere.nodes.Server
Derived From: cloudify.nodes.Compute
Properties:
serverkey-value server configuration.nameserver name. Note that this MUST NOT contain any characters other than A-Z, a-z, 0-9, hyphens (-), and underscores (_, which will be converted to hyphens). It must not be entirely composed of digits (0-9). It will have a unique suffix appended to it, allowing multiple instances for one node. If the name parameter is not specified, the node name from the blueprint will be used, with the same restrictions applyingtemplatevirtual machine template from which server will be spawned. For more information, see the Misc section - Virtual machine template.cpusnumber of CPUs.memoryamount of RAM, in MB.
networkingkey-value server networking configuration.domainthe DNS suffix to use on this server.dns_serverslist of DNS servers.connect_networkslist of existing networks to which server will be connected, described as key-value objects. The network(s) must be described as:nameName of port group or distributed port group on vSphere.managementsignifies if it’s a management network (false by default). Only one connected network can be management. This network will have its IP listed under the runtime property ‘ip’, but will not otherwise have any impact on the way this interface is configured.externalsignifies if it’s an external network (false by default). Only one connected network can be external. This network will be the first network attached to the server and will have its IP listed under the runtime property ‘public_ip’, but will not otherwise have any impact on the way this interface is configured.switch_distributedsignifies if network is connected to a distributed switch (false by default).use_dhcpuse DHCP to obtain an ip address (true by default).networknetwork cidr (for example, 10.0.0.0/24). It will be used by the plugin only whenuse_dhcpis false.gatewaynetwork gateway ip. It will be used by the plugin only whenuse_dhcpis false.ipserver ip address. It will be used by the plugin only whenuse_dhcpis false.
connection_configkey-value vSphere environment configuration. If not specified, values that were used for Cloudify bootstrap process will be used.usernamevSphere username.passworduser password.hostvCenter host name or IP.portvCenter port for SDK (443 by default).datacenter_namedatacenter name.resource_pool_namename of a resource pool. If you do not with to use a resource pool this must be set to ‘Resources’ as this is the base resource pool on vSphere.auto_placementsignifies whether to use vSphere’s auto-placement instead of the plugin’s. Must be true if you are using clusters. (false by default).
Runtime properties:
nameName of the server on vsphere and in the OSipManagement IP address of the server (as determined by finding the IP of whichever network is set as management), or the IP of the first attached network on the server (if no management interface is set). This will be null/None if there are no attached networks.public_ipExternal IP address of server (as determined by finding the IP of whichever network is set as external), or nothing if there is no network set as external.vsphere_server_idInternal ID of server on vsphere (e.g. vm-1234)networkslist of key-value details of attached networksdistributedWhether or not this is a distributed networknameThe name of this networkmacThe MAC address of the NIC on this networkipThe IP address assigned to the NIC on this network, or None if there is no IP
cloudify.vsphere.nodes.WindowsServer
Derived From: cloudify.nodes.Compute
Properties:
windows_passwordThe password to set for the administrator account on the Windows system. If this is not supplied then the value under properties.agent_config.password will be used. If neither are supplied, an error will be raised when running install workflows.windows_timezoneThe timezone to set the Windows system to. It will default to 90 (GMT without daylight savings (approximately UTC)). If you wish to set this it must be set to an appropriate integer valuewindows_organizationThe organization name to set on the Windows system. It will default to: Organizationcustom_sysprepA custom sysprep answers file to use for full customization of Windows. Please note that this should be verified to work beforehand, as any errors will only appear on Windows and will not be visible to the plugin. Please note also that any scripts, etc, which attempt to work on the VM after the custom sysprep must be tolerant of multiple retries, as the plugin cannot detect when the custom sysprep has finished so will provide the server as soon as IPs are assigned (which will be before customization is complete).serverkey-value server configuration.nameserver name. Note that this MUST NOT contain any characters other than A-Z, a-z, 0-9, hyphens (-), and underscores (_, which will be converted to hyphens). It must not be entirely composed of digits (0-9). It will be truncated at 8 characters to permit a unique identifier suffix, allowing multiple instances for one node. If the name parameter is not specified, the node name from the blueprint will be used, with the same restrictions applyingtemplatevirtual machine template from which server will be spawned. For more information, see the Misc section - Virtual machine template.cpusnumber of CPUs.memoryamount of RAM, in MB.
networkingkey-value server networking configuration.domainthe DNS suffix to use on this server.dns_serverslist of DNS servers.connect_networkslist of existing networks to which server will be connected, described as key-value objects. The network(s) must be described as:nameName of port group or distributed port group on vSphere.managementsignifies if it’s a management network (false by default). Only one connected network can be management. This network will have its IP listed under the runtime property ‘ip’, but will not otherwise have any impact on the way this interface is configured.externalsignifies if it’s an external network (false by default). Only one connected network can be external. This network will be the first network attached to the server and will have its IP listed under the runtime property ‘public_ip’, but will not otherwise have any impact on the way this interface is configured.switch_distributedsignifies if network is connected to a distributed switch (false by default).use_dhcpuse DHCP to obtain an ip address (true by default).networknetwork cidr (for example, 10.0.0.0/24). It will be used by the plugin only whenuse_dhcpis false.gatewaynetwork gateway ip. It will be used by the plugin only whenuse_dhcpis false.ipserver ip address. It will be used by the plugin only whenuse_dhcpis false.
connection_configkey-value vSphere environment configuration. If not specified, values that were used for Cloudify bootstrap process will be used.usernamevSphere username.passworduser password.hostvCenter host name or IP.portvCenter port for SDK (443 by default).datacenter_namedatacenter name.resource_pool_namename of a resource pool. If you do not with to use a resource pool this must be set to ‘Resources’ as this is the base resource pool on vSphere.auto_placementsignifies whether to use vSphere’s auto-placement instead of the plugin’s. Must be true if you are using clusters. (false by default).
Runtime properties:
nameName of the server on vsphere and in the OSipManagement IP address of the server (as determined by finding the IP of whichever network is set as management)public_ipExternal IP address of server (as determined by finding the IP of whichever network is set as external)vsphere_server_idInternal ID of server on vsphere (e.g. vm-1234)networkslist of key-value details of attached networksdistributedWhether or not this is a distributed networknameThe name of this networkmacThe MAC address of the NIC on this networkipThe IP address assigned to the NIC on this network, or None if there is no IP
cloudify.vsphere.nodes.Network
Derived From: cloudify.nodes.Network
Properties:
networkkey-value network configuration.namenetwork namevlan_idvLAN identifier which will be assignee to the network.vswitch_namevSwitch name to which the network will be connected
connection_configkey-value vSphere environment configuration. Same as forcloudify.vsphere.servertype.
Runtime properties:
network_nameName of the network on vsphereswitch_distributedTrue if this is a distributed port group, False otherwise.
cloudify.vsphere.nodes.Storage
Derived From: cloudify.nodes.Volume
Properties:
storagekey-value storage disk configuration.storage_sizedisk size in GB.
connection_configkey-value vSphere environment configuration. Same as forcloudify.vsphere.servertype.
Runtime properties:
attached_vm_idInternal ID of attached server on vsphere (e.g. vm-1234)attached_vm_nameName of the attached server on vsphere and in the OSdatastore_file_nameThe datastore and filename on that datastore of this virtual disk. e.g. “[Datastore-1] myserver-a12b3/myserver-a12b3_1.vmdk”scsi_idSCSI ID in the form of bus_id:unit_id, e.g. “0:1”
Examples
Example I
example_server:
type: cloudify.vsphere.nodes.Server
properties:
networking:
domain: example.com
dns_servers: ['8.8.8.8']
connected_networks:
- name: example_management_network
management: true
switch_distributed: false
use_dhcp: true
- name: example_external_network
external: true
switch_distributed: true
use_dhcp: false
network: 10.0.0.0/24
gateway: 10.0.0.1
ip: 10.0.0.2
- name: example_network
switch_distributed: false
use_dhcp: true
server:
name: example_server
template: example_server_template
cpus: 1
memory: 512
relationships:
- type: cloudify.relationships.depends_on
target: example_network
example_network:
type: cloudify.vsphere.nodes.Network
properties:
network:
name: example_network
vlan_id: 101
vswitch_name: vSwitch0
switch_distributed: false
example_storage:
type: cloudify.vsphere.nodes.Storage
properties:
storage:
storage_size: 1
relationships:
- target: example_server
type: cloudify.vsphere.storage_connected_to_server
Node by node explanation:
Creates a server. In the server ‘networking’ property we specified desired domain name as ‘example.com’, additional DNS server 8.8.8.8, and three existing networks we want to connect to: example_management_network, example_external_network and example_network. In the ‘server’ property we specified server name as example_server, vm template name as example_server_template, number of cpus as 1, and RAM as 512 MB.
Creates a network. We specified network name as example_network, network vLAN id as 101, and an existing vSwitch name we want to connect to as example_vswitch.
Creates a virtual hard disk. We specified desired storage size as 1 GB and wish to add this storage to example_server vm.