ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director
-
Upload
clogeny-technologies -
Category
Technology
-
view
24 -
download
2
description
Transcript of ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director
![Page 1: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/1.jpg)
Writing a Knife Plugin for your shiny new VMWare vCloud
Director
Chirag Jog, CTO [email protected]
Innovation → Execution → Solution → Delivered
![Page 2: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/2.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
About Me
Built cutting edge products:• Hybrid Cloud
Migration Appliances• Enterprise Java PaaS• Multi-cloud single
pane of glass Dashboard
Contributed to several knife plugins• VMWare vCloud
Director• Google Compute
Engine• Windows Azure• Citrix Cloudstack• Terremark• Amazon EC2
Co-founder/CTO at Clogeny
![Page 3: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/3.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Agenda
What is the knife plugins ?
The Knife cloud plugin framework
VMWare vCloud Director API Model
Code Walkthrough of the knife-vcloud
plugin
Demo of the knife vcloud plugin
![Page 4: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/4.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
What are knife cloud plugins ?
Extend Knife to support additional functionality
Virtual Machine Life cycle Server Create
Linux and Windows Bootstrapping
Server Destroy
List available cloud resources Images
Flavors / Server Types
Networks
Servers
![Page 5: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/5.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Available Cloud Plugins
![Page 6: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/6.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife Plugin Usage
gem install knife-<cloudname>
![Page 7: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/7.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife Plugin Usage
gem install knife-<cloudname>knife <cloudname> server create
![Page 8: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/8.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife Plugin Usage
gem install knife-<cloudname>knife <cloudname> server create• Flavor or Server size• Image• Zone/Region• Template/Distro• Chef Node Name• SSH params – ssh username, password, keypair,
keypair file• WinRM params – username, password,
AD/Kerberos params• Cloud Vendor Credentials
![Page 9: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/9.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife Plugin Usage
knife <cloudname> server delete• Chef Node Name• Purge Node/Client
knife <cloudname> server listknife <cloudname> image listknife <cloudname> flavor list
![Page 10: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/10.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
High Level Diagram
...
knife-ec2
knife-rackspace
Knife-vcloud
….
AWS Driver
Rackspace Driver
Fog library
vCloud Driver
![Page 11: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/11.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
High Level Diagram
...
knife-ec2
knife-rackspace
Knife-vcloud
….
AWS Driver
Rackspace Driver
Fog library
vCloud Driver
![Page 12: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/12.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
fog.io
Knife Cloud plugins use fog to communicate with the Cloud services
![Page 13: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/13.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Fog
Fog - Multi-Cloud Services Library
Open source, Community driven
Portable, Powerful, Established
Simulated Fog behavior using Mock
Organizes resources – servers, images,
networks, vapps as collection of models.
![Page 14: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/14.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Using Fog
$ gem install fog
Fetching: fog-1.10.1.gem (100%)
Successfully installed fog-1.10.1
1 gem installed
![Page 15: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/15.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Using Fog Interactive
$ fog Welcome to fog interactive!>> connection = Fog::Compute.new(:provider => <Cloud Provider>, credential params..) >> images = connection.images.all[<Fog::Compute::Cloud::Image id=…, name=“ubuntu”>, <Fog::Compute::Cloud::Image id=…, name=“centos”>…]>> servers = connection.servers.all>> server = connection.servers.create(server_def_params)
![Page 16: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/16.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Using Fog Interactive
$ fog Welcome to fog interactive!>> connection = Fog::Compute.new(:provider => <Cloud Provider>, credential params..) >> images = connection.images.all[<Fog::Compute::Cloud::Image id=…, name=“ubuntu”>, <Fog::Compute::Cloud::Image id=…, name=“centos”>…]>> servers = connection.servers.all>> server = connection.servers.create(server_def_params)
![Page 17: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/17.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Using Fog Interactive
$ fog Welcome to fog interactive!>> connection = Fog::Compute.new(:provider => <Cloud Provider>, credential params..) >> images = connection.images.all[<Fog::Compute::Cloud::Image id=…, name=“ubuntu”>, <Fog::Compute::Cloud::Image id=…, name=“centos”>…]>> servers = connection.servers.all>> server = connection.servers.create(server_def_params)
![Page 18: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/18.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Using Fog Interactive
$ fog Welcome to fog interactive!>> connection = Fog::Compute.new(:provider => <Cloud Provider>, credential params..) >> images = connection.images.all[<Fog::Compute::Cloud::Image id=…, name=“ubuntu”>, <Fog::Compute::Cloud::Image id=…, name=“centos”>…]>> servers = connection.servers.all>> server = connection.servers.create(server_def_params)
![Page 19: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/19.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
High Level Diagram
...
knife-ec2
knife-rackspace
Knife-vcloud
….
AWS Driver
Rackspace Driver
Fog library
vCloud Driver
![Page 20: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/20.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife plugin – Fog collections
knife-cloud
knife cloud server create
knife cloud server delete
knife cloud server list
knife cloud flavor list
knife cloud image list
servers
images
flavors
Fog Collections
![Page 21: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/21.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife plugin – Fog collections
knife-cloud
knife cloud server create
knife cloud server delete
knife cloud server list
knife cloud flavor list
knife cloud image list
servers
images
flavors
Fog Collections
![Page 22: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/22.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server createclass Chef class Knife class CloudServerCreate < Knife
banner "knife vcloud server create (options)”
option :flavor, :short => "-f FLAVOR_ID", :long => "--flavor FLAVOR_ID", :description => "The flavor ID of server (m1.small, m1.medium, etc)", :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
option :image, :short => "-I IMAGE_ID", :long => "--image IMAGE_ID", :description => "The image ID for the server", :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
option :chef_node_name …. option :zone … Several bootstrapping options
![Page 23: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/23.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server createclass Chef class Knife class CloudServerCreate < Knife
banner "knife vcloud server create (options)”
option :flavor, :short => "-f FLAVOR_ID", :long => "--flavor FLAVOR_ID", :description => "The flavor ID of server (m1.small, m1.medium, etc)", :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
option :image, :short => "-I IMAGE_ID", :long => "--image IMAGE_ID", :description => "The image ID for the server", :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
option :chef_node_name …. option :zone … Several bootstrapping options
Inherit from the Chef::Knife class
![Page 24: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/24.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server createclass Chef class Knife class CloudServerCreate < Knife
banner "knife vcloud server create (options)”
option :flavor, :short => "-f FLAVOR_ID", :long => "--flavor FLAVOR_ID", :description => "The flavor ID of server (m1.small, m1.medium, etc)", :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
option :image, :short => "-I IMAGE_ID", :long => "--image IMAGE_ID", :description => "The image ID for the server", :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
option :chef_node_name …. option :zone … Several bootstrapping options
Usage Banner
Inherit from the Chef::Knife class
![Page 25: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/25.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server createclass Chef class Knife class CloudServerCreate < Knife
banner "knife vcloud server create (options)”
option :flavor, :short => "-f FLAVOR_ID", :long => "--flavor FLAVOR_ID", :description => "The flavor ID of server (m1.small, m1.medium, etc)", :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
option :image, :short => "-I IMAGE_ID", :long => "--image IMAGE_ID", :description => "The image ID for the server", :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
option :chef_node_name …. option :zone … Several bootstrapping options
Parameter Options like Server size,
Image, Zone and Bootstrapping
Options
Usage Banner
Inherit from the Chef::Knife class
![Page 26: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/26.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
![Page 27: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/27.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
Knife commands are run by calling the `#run` method on an instance of your command class
![Page 28: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/28.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
Knife commands are run by calling the `#run` method on an instance of your command class
Create the fog connection object
![Page 29: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/29.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
Knife commands are run by calling the `#run` method on an instance of your command class
Create the fog connection object
Create and configure the server
![Page 30: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/30.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
Knife commands are run by calling the `#run` method on an instance of your command class
Create the fog connection object
Create and configure the server
Wait for WinRM/SSH Service to start
![Page 31: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/31.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server create (run)def run - validate compulsory parameters ….
connection = Fog::Compute.new(…) … Cloud provider based checks … server = connection.servers.create(params) … Cloud provider specific logic – Enable Networking, Associate IP Address, Reconfigure Server … if windows_image? wait_for_winrm else wait_for_sshd end
// Server is now up and runningBootstrap the Node
end
Knife commands are run by calling the `#run` method on an instance of your command class
Create the fog connection object
Create and configure the server
Wait for WinRM/SSH Service to start
Windows or Linux Bootstrapping
![Page 32: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/32.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Bootstrapping
Installs Chef and runs the chef-client to communicate with a Chef Server• via SSH• via Windows Remote
Management(WinRM)
Ref: http://www.lemen.com/imageBootstrap1.html
![Page 33: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/33.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife plugin – Fog collections
knife-cloud
knife cloud server create
knife cloud server delete
knife cloud server list
knife cloud flavor list
knife cloud image list
servers
images
flavors
Fog Collections
![Page 34: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/34.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud server deleteclass Chef class Knife class CloudServerDelete < Knife
banner "knife vcloud server delete (options)”
def run validate compulsory parameters …. connection = Fog::Compute.new(…)
Check whether server(s) exists or not@name_args.each do |server_id|
begin server = connection.servers.get(server_id) if !server
ui.warn(“Server does not exists”)next
end confirm("Do you really want to delete this server”) server.destroy ui.warn("Deleted server #{server.id}") #Destroy Chef Node # Destroy Chef Clientend
Inherit from the Chef::Knife class
Usage Banner
Find the Server and Delete it
![Page 35: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/35.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife plugin – Fog collections
knife-cloud
knife cloud server create
knife cloud server delete
knife cloud server list
knife cloud flavor list
knife cloud image list
servers
images
flavors
Fog Collections
![Page 36: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/36.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife cloud image listclass Chef class Knife class CloudImageList < Knife
banner "knife cloud image list (options)"
def run image_list = [ ui.color('ID', :bold), ui.color('Name', :bold) ]
connection.images.sort_by(&:name).each do |image| image_list << image.id.to_s image_list << image.name end
puts ui.list(image_list, :uneven_columns_across, 2) end end endend
Inherit from the Chef::Knife class
Usage Banner
List Resource and Display it
![Page 37: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/37.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Knife plugin – Fog collections
knife-cloud
knife cloud server create
knife cloud server delete
knife cloud server list
knife cloud flavor list
knife cloud image list
servers
images
flavors
Fog Collections
![Page 38: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/38.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife plugin directory structure
knife-vcloud├── Gemfile├── knife-vcloud.gemspec├── lib ├ chef├ knife-vcloud├ version.rb
├ knife├ vcloud_server_create.rb├ vcloud_server_delete.rb├ vcloud_image_list.rb├── spec├── README.md └── LICENSE
![Page 39: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/39.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife plugin directory structure
knife-vcloud├── Gemfile├── knife-vcloud.gemspec├── lib ├ chef├ knife-vcloud├ version.rb
├ knife├ vcloud_server_create.rb├ vcloud_server_delete.rb├ vcloud_image_list.rb├── spec├── README.md └── LICENSE
Parent Directory
![Page 40: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/40.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife plugin directory structure
knife-vcloud├── Gemfile├── knife-vcloud.gemspec├── lib ├ chef├ knife-vcloud├ version.rb
├ knife├ vcloud_server_create.rb├ vcloud_server_delete.rb├ vcloud_image_list.rb├── spec├── README.md └── LICENSE
Required to build the gem
Parent Directory
![Page 41: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/41.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife plugin directory structure
knife-vcloud├── Gemfile├── knife-vcloud.gemspec├── lib ├ chef├ knife-vcloud├ version.rb
├ knife├ vcloud_server_create.rb├ vcloud_server_delete.rb├ vcloud_image_list.rb├── spec├── README.md └── LICENSE
Version Info
Required to build the gem
Parent Directory
![Page 42: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/42.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife plugin directory structure
knife-vcloud├── Gemfile├── knife-vcloud.gemspec├── lib ├ chef├ knife-vcloud├ version.rb
├ knife├ vcloud_server_create.rb├ vcloud_server_delete.rb├ vcloud_image_list.rb├── spec├── README.md └── LICENSE
Actual Code
Version Info
Required to build the gem
Parent Directory
![Page 43: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/43.jpg)
VMWare vCloud Director
![Page 44: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/44.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
VMWare vCloud Director
Reference: http://www.vmguru.nl/wordpress/2012/01/vmware-vcloud-director-design-guidelines/
![Page 45: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/45.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
vApps
Container of one or more VMs• Package up Multi-tier
Applications into vApps
• Operate on VMs as one unit
• Can be created by scratch
• Can be imported from outside the cloud
Reference: http://download3.vmware.com/vcat/documentation-center/index.html#page/Consuming%20a%20vCloud/3c%20Consuming%20a%20VMware%20vCloud.2.077.html
![Page 46: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/46.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Catalogs
Catalogs are collections of vApps, vApps Templates and mediaExamples:• Infrastructure as Service Catalogs• Pre-installed Windows/Linux VMs• OS Media files• App Catalogs
![Page 47: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/47.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
vCloud Layered Network
External Network
Organization
Network
vApp Network
External Network : Providing a connection to the outside worldOrganization Network : Network contained within an organizationvApp Network : Network contained within a vApp
Ref: http://hol-prt.cloudfoundry.com/HOL-PRT-04_EN/HOL-PRT-04-m1/lessons/vCloud_Director_networking_and_Cisco_Nexus_1000V.html
![Page 48: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/48.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife-vcloud
Git repo: https://github.com/opscode/knife-vcloudSupport to provision one-VM vApps onto the Org-level networkSupported Commands:• knife vcloud server create• knife vcloud server list • knife vcloud server delete• knife vcloud image list• knife vcloud network list
![Page 49: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/49.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife-vcloud
Git repo: https://github.com/opscode/knife-vcloudSupport to provision one-VM vApps onto the Org-level networkSupported Commands:• knife vcloud server create• knife vcloud server list • knife vcloud server delete• knife vcloud image list• knife vcloud network list
Lets focus on it!
![Page 50: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/50.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp
Ref: http://hol-prt.cloudfoundry.com/HOL-PRT-04_EN/HOL-PRT-04-m1/lessons/vCloud_Director_networking_and_Cisco_Nexus_1000V.html
Select the vApp Template.
![Page 51: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/51.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp
Ref: http://hol-prt.cloudfoundry.com/HOL-PRT-04_EN/HOL-PRT-04-m1/lessons/vCloud_Director_networking_and_Cisco_Nexus_1000V.html
Select the vApp Template.Select the Network
![Page 52: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/52.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp
Ref: http://hol-prt.cloudfoundry.com/HOL-PRT-04_EN/HOL-PRT-04-m1/lessons/vCloud_Director_networking_and_Cisco_Nexus_1000V.html
Select the vApp Template.Select the NetworkProvide a name, administrator Password to the vApp being deployed.
![Page 53: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/53.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp
Select the vApp Template.Select the NetworkProvide a name, administrator Password to the vApp being deployed.Configure the virtual machines inside the vApp, including • computer name, • CPU and Memory• Network and IP Assignment.
![Page 54: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/54.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp
Select the vApp Template.Select the NetworkProvide a name, administrator Password to the vApp being deployed.Configure the virtual machines inside the vApp, including • computer name, • CPU and Memory• Network and IP Assignment.
Bootstrapping!
![Page 55: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/55.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp(Deep-Dive)
Select the vApp Template.
![Page 56: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/56.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp(Deep-Dive)
Select the vApp Template.
![Page 57: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/57.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp(Deep-Dive)
Select the vApp Template.
![Page 58: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/58.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp(Deep-Dive)
Select the vApp Template.
![Page 59: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/59.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp(Deep-Dive)
Select the vApp Template.
![Page 60: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/60.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the Network
![Page 61: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/61.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the Network
![Page 62: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/62.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the Network
![Page 63: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/63.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the NetworkBuild the server spec and deploy the vApp
![Page 64: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/64.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the NetworkBuild the server spec and deploy the vApp
![Page 65: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/65.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the NetworkBuild the server spec and deploy the vApp
![Page 66: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/66.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Select the vApp Template.Select the NetworkBuild the server spec and deploy the vApp
![Page 67: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/67.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Additional Configuration
![Page 68: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/68.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Additional Configuration
![Page 69: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/69.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Additional Configuration
![Page 70: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/70.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Additional Configuration
![Page 71: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/71.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Additional Configuration
![Page 72: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/72.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Save Additional Configuration
![Page 73: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/73.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Power On!
![Page 74: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/74.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Wait until ready
![Page 75: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/75.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Linux Bootstrapping!
![Page 76: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/76.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Linux Bootstrapping!
![Page 77: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/77.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Linux Bootstrapping!
![Page 78: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/78.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Windows Bootstrapping!
![Page 79: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/79.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Deploying a vApp (Deep-Dive)
Windows Bootstrapping!
![Page 80: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/80.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server create (Linux)knife vcloud server create --image <vApp-Linux-template ID>--node-name linux_node_test --network <Network ID>--ssh-user <SSH Username>--ssh-password <SSH Password>--distro chef-full
![Page 81: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/81.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server create (Windows)
knife vcloud server create --image <vApp-Windows-template ID>--node-name windows_node_test--network <Network ID>--bootstrap-protocol winrm--winrm-password <Windows WinRM Password>--template-file ../knife-windows/lib/chef/knife/bootstrap/windows-chef-client-msi.erb -VV
![Page 82: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/82.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Demo
![Page 83: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/83.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server create
Source Code: https://github.com/opscode/knife-vcloud/blob/master/lib/chef/knife/vcloud_server_create.rb
![Page 84: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/84.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server delete
Identify the vApp to deletePower Off the vAppDelete the vApp
![Page 85: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/85.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server delete
Identify the vApp to deletePower Off the vAppDelete the vApp
![Page 86: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/86.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Resource Listing
• knife vcloud server list• knife vcloud image list• Knife vcloud network list
![Page 87: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/87.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud server list
![Page 88: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/88.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud image list
![Page 89: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/89.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
knife vcloud network list
![Page 90: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/90.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Demo
![Page 91: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/91.jpg)
http://www.clogeny.com © 2012 Clogeny Technologies
Chefs: now with Knife expertise!
Ref: http://s3.hubimg.com/u/1691762_f520.jpg
![Page 92: ChefConf 2013 Talk: Writing a Knife cloud plugin for your shiny VMWare vCloud Director](https://reader038.fdocuments.net/reader038/viewer/2022103109/54562f3caf79591d5a8bb042/html5/thumbnails/92.jpg)
Thank You!
Innovation → Execution → Solution → Delivered
Feel free to reach out :Email: [email protected]
Twitter: @cheezo