Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Use OpenStack as a Vagrant Provider

Julien Vey
November 05, 2014

Use OpenStack as a Vagrant Provider

Vagrant is a very popular tool within developer communities. It makes easy to manage virtual machines and is very useful to set up development or staging environments. Vagrant can be plugged on various VM providers using its plug-in mechanism, VirtualBox, Docker, AWS... In this talk we will present the open source project Vagrant Openstack Provider, implementing a plug-in to use Openstack as a cloud provider for Vagrant. We will present how to use it, the key features, some interesting use cases and the roadmap for future releases.

Julien Vey

November 05, 2014
Tweet

More Decks by Julien Vey

Other Decks in Programming

Transcript

  1. Repeatable Build and destroy environments in a second Configurable Describe

    all the steps to build an environment in a single file Easy to use Simple command line client to manage environments
  2. not created active shutdown suspended up suspend halt up up

    resume destroy But also… $ vagrant ssh $ vagrant status $ vagrant provision
  3. Scale As many instances as your quotas allow Share Created

    instances can be shared with team members
  4. Vagrant.configure('2') do |config| config.ssh.username = 'stack' config.vm.provider :openstack do |os|

    os.openstack_auth_url = 'http://keystone-server.net/v2.0/tokens' os.username = 'openstackUser' os.password = 'openstackPassword' os.tenant_name = 'myTenant' os.flavor = 'm1.small' os.image = 'ubuntu' os.floating_ip_pool = 'publicNetwork' end end
  5. Keystone Authenticate & Resolve Catalog Resolve Image Resolve Flavor Resolve

    Floating IP Create Instance Assign Floating IP Nova
  6. SSH Key Generation How it works $ vagrant up generate

    ssh keypair upload public key to nova launch instance with generated keypair store private key locally
  7. SSH Key Generation How it works $ vagrant ssh use

    private key generated previously
  8. SSH Key Generation How it works Keys are generated in

    .vagrant/machines/<machine_name>/openstack/ With name vagrant-generated-<hash> Easy to debug ssh connection with ssh -i .vagrant/… user@machine
  9. Floating IP allocation Use available IP from a pool or

    allocate a new one config.vm.provider :openstack do |os| os.floating_ip_pool = 'PublicNetwork' end
  10. Assign networks Attach networks by name, by id,with fixed IP

    address… config.vm.provider :openstack do |os| os.networks = [ 'net-name-01', '287132f0-57e6-4c31-a1ee-4823e9786ff2', { name: 'net-name-03', address: '192.168.22.43' } ] end
  11. Attach Volumes Attach volumes by name, by id, with device…

    config.vm.provider :openstack do |os| os.volumes = [ '619e027c-f4a9-493d-8c15-c89de81cb949', 'vol-name-02', { id: '410096ff-ef71-4ca4-8006-e5bd9e99239a', device: '/dev/vdc' }, { name: 'vol-name-04', device: '/dev/vde' } ] end
  12. Custom commands OpenStack specific commands in vagrant $ vagrant openstack

    Usage: vagrant openstack command Available subcommands: image-list List available images flavor-list List available flavors network-list List private networks in project floatingip-list List floating IP and floating IP pools volume-list List existing volumes
  13. Custom commands OpenStack specific commands in vagrant $ vagrant openstack

    image-list +--------------------------------------+---------------------+ | Id | Name | +--------------------------------------+---------------------+ | 594f1287-9de3-4f3e-b82a-6ad223943ab2 | ubuntu-12.04_x86_64 | | 3e5aca4a-bf12-4721-87df-7bc8fd1fc36c | debian7_x86_64 | | 3e561121-d8d0-4328-b319-7076bfb3b18a | ubuntu-14.04_x86_64 | | 5c576643-7ea3-49db-b1c0-9b245d955ee0 | rhel65_x86_64 | | d3145dd5-654a-4936-b421-9333f02ae66c | centos6_x86_64 | +--------------------------------------+---------------------+
  14. Custom commands OpenStack specific commands in vagrant $ vagrant openstack

    network-list +--------------------------------------+---------+ | Id | Name | +--------------------------------------+---------+ | 8d5d2ee2-45e8-477c-983b-aabd4741b8bf | privnet | | a225de34-ed21-cca2-5692-8d5d2ee2ea43 | pubnet | +--------------------------------------+---------+
  15. vagrant up … vagrant take-away push OpenStack Cloud Storage system

    (Swift, S3, Dropbox…) Machine A Machine B vagrant take-away pull … vagrant destroy Vagrant Instance record
  16. Team work Allow team members to manage a single environment

    Remote work Manage the same environment from different work places
  17. Improve private instances usage Allow to configure multiples instances through

    a single public IP Upload images in glance Configure image url or local path in the Vagrantfile Snapshots Manage snapshots (volumes and instances)
  18. You are a Cloud Provider ? Test the provider on

    your OpenStack Report issues Ask for features
  19. You are a Developer ? Contribute Code Look for issues

    (We label all easy issues ‘quickwin’) Review pull requests