This is an Opscode Knife plugin to interact with VMware’s vSphere. This plugin currently lists, clones, and deletes Virtual Machines and Templates; it will soon be able to apply run lists to vSphere-manged virtual machines,
gem install knife-vsphere
For initial development, the plugin targets all communication at a vCenter instance rather than at specific hosts. Only named user authentication is currently supported; you’ll need to add the credentials to your knife.rb
file:
knife[:vsphere_host] = "vcenter-hostname" knife[:vsphere_user] = "privileged username" knife[:vsphere_pass] = "your password" knife[:vsphere_dc] = "your-datacenter"
Environment variables and command-line credentials are not currently supported, but will be forthcoming soon.
This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a --help
flag
Enumerates the Virtual Machines registered in the target datacenter. Only name is currently displayed.
-r, --recursive - Recurse down through sub-folders to the specified folder --only-folders - In combination with --recursive, print only folder names
Enumerates the VM Templates registered in the target datacenter. Only name is currently displayed.
Enumerates the customization specifications registered in the target datacenter. Only name is currently displayed.
knife vsphere vm clone –template <source template name> –vmname <new vm name> –cspec <customization_spec>¶ ↑
e.g. knife vsphere vm clone NewNode UbuntuTemplate –cspec StaticSpec \
--cips 192.168.0.99/24,192.168.1.99/24 \ --chostname NODENAME --cdomain NODEDOMAIN --dest-folder FOLDER - The folder into which to put the cloned VM --datastore STORE - The datastore into which to put the cloned VM --resource-pool POOL - The resource pool into which to put the cloned VM --template TEMPLATE - The source VM / Template to clone from --cspec CUST_SPEC - The name of any customization specification to apply --cvlan CUST_VLAN - VLAN name for network adapter to join --cips CUST_IPS - Comma-delimited list of CIDR IPs for customization --cgw CUST_GW - CIDR IP of gateway for customization --chostname CUST_HOSTNAME - Unqualified hostname for customization --cdomain CUST_DOMAIN - Domain name for customization --ctz CUST_TIMEZONE - Timezone invalid 'Area/Location' format --ccpu CUST_CPU_COUNT - Number of CPUs --cram CUST_MEMORY_GB - Gigabytes of RAM --start STARTVM - Indicates whether to start the VM after a successful clone --bootstrap FALSE - Indicates whether to bootstrap the VM --fqdn SERVER_FQDN - Fully qualified hostname for bootstrapping --ssh-user USERNAME - SSH username --ssh-password PASSWORD - SSH password --ssh-port PORT - SSH port --identity-file IDENTITY_FILE - SSH identity file used for authentication --node-name NAME - The Chef node name for your new node --prerelease - Install the pre-release chef gems --bootstrap-version VERSION - The version of Chef to install --bootstrap-proxy PROXY_URL - The proxy server for the node being bootstrapped --distro DISTRO - Bootstrap a distro using a template --template-file TEMPLATE - Full path to location of template to use --run-list RUN_LIST - Comma separated list of roles/recipes to apply --no-host-key-verify - Disable host key verification",
Clones an existing VM template into a new VM instance, optionally applying an existing customization specification.
Unregisters an existing VM. Currently, it does not perform any datastore cleanup to remove VM files.
Lists all known datastores with capacity and usage
- Authors
-
Ezra Pagel <[email protected]> Jesse Campbell <[email protected]> John Williams <[email protected]>
- Copyright
-
Copyright © 2011-2012 Ezra Pagel
VMware vSphere is a trademark of VMware, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.