Slide 1

Slide 1 text

Use OpenStack as a Vagrant Provider

Slide 2

Slide 2 text

Julien Vey Numergy @julienvey Guillaume Giamarchi Numergy @ggiamarchi

Slide 3

Slide 3 text

Vagrant : Development environments made easy

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

STEP 1 Describe your environment

Slide 6

Slide 6 text

Vagrant.configure('2') do |config| config.vm.box = 'base' config.vm.provision 'shell', inline: 'apt-get install -y git' end Vagrantfile

Slide 7

Slide 7 text

STEP 2 Start it!

Slide 8

Slide 8 text

$ vagrant up

Slide 9

Slide 9 text

That’s all you need to get started

Slide 10

Slide 10 text

Vagrant manages Virtual Instances

Slide 11

Slide 11 text

not created active shutdown suspended up suspend halt up up resume destroy But also… $ vagrant ssh $ vagrant status $ vagrant provision

Slide 12

Slide 12 text

Vagrant uses Providers (default is VirtualBox)

Slide 13

Slide 13 text

Built-in Providers

Slide 14

Slide 14 text

VirtualBox VMWare (charged) Docker Hyper-V

Slide 15

Slide 15 text

$ vagrant up VirtualBox VM on your local machine

Slide 16

Slide 16 text

$ vagrant up 1 x 1 x VirtualBox VM on your local machine

Slide 17

Slide 17 text

$ vagrant up VirtualBox VM on your local machine n x n x

Slide 18

Slide 18 text

Local resources are LIMITED

Slide 19

Slide 19 text

We need More resources

Slide 20

Slide 20 text

Cloud resources are (virtually) UNLIMITED

Slide 21

Slide 21 text

Vagrant works with Plugins

Slide 22

Slide 22 text

Some plugins… Provision vagrant-berkshelf, vagrant-puppet-install, vagrant-fabric… Local Domain Resolution vagrant-dns, vagrant-hostmanager… Testing vagrant-cucumber, vagrant-serverspec…

Slide 23

Slide 23 text

Custom Providers

Slide 24

Slide 24 text

vagrant-aws vagrant-azure vagrant-digitalocean vagrant-kvm vagrant-lxc … and many more

Slide 25

Slide 25 text

Vagrant OpenStack Provider github.com/ggiamarchi/vagrant-openstack-provider

Slide 26

Slide 26 text

Why an OpenStack provider ?

Slide 27

Slide 27 text

Scale As many instances as your quotas allow Share Created instances can be shared with team members

Slide 28

Slide 28 text

Vagrant OpenStack Provider Quick Start

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

$ vagrant up --provider=openstack

Slide 31

Slide 31 text

Keystone Authenticate & Resolve Catalog Resolve Image Resolve Flavor Resolve Floating IP Create Instance Assign Floating IP Nova

Slide 32

Slide 32 text

some features will require other openstack services

Slide 33

Slide 33 text

Supported features up/halt suspend/resume ssh reload provision

Slide 34

Slide 34 text

Specific features SSH key generation Floating IPs Networks Volumes Custom commands

Slide 35

Slide 35 text

SSH Key generation

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

SSH Key Generation How it works $ vagrant ssh use private key generated previously

Slide 38

Slide 38 text

SSH Key Generation How it works Keys are generated in .vagrant/machines//openstack/ With name vagrant-generated- Easy to debug ssh connection with ssh -i .vagrant/… user@machine

Slide 39

Slide 39 text

SSH key configuration is no longer needed

Slide 40

Slide 40 text

Floating IP allocation

Slide 41

Slide 41 text

Floating IP allocation Directly assign already allocated floating IP config.vm.provider :openstack do |os| os.floating_ip = '80.81.82.83' end

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

Assign Networks

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

Attach Volumes

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

Boot from Volume

Slide 48

Slide 48 text

Boot from Volume config.vm.provider :openstack do |os| os.volume_boot = '619e027c-f4a9-493d-8c15-c89de81cb949' end

Slide 49

Slide 49 text

Custom Commands

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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 | +--------------------------------------+---------------------+

Slide 52

Slide 52 text

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 | +--------------------------------------+---------+

Slide 53

Slide 53 text

Demo Multi machines

Slide 54

Slide 54 text

MongoExpress Web Interface Nova Instance mongofront MongoDB Database Mongo Data Nova Instance mongoback Cinder Volume

Slide 55

Slide 55 text

another feature we want to provide…

Slide 56

Slide 56 text

vagrant up OpenStack Cloud Machine A Machine B vagrant destroy Vagrant Instance

Slide 57

Slide 57 text

Introducing vagrant-take-away github.com/ggiamarchi/vagrant-take-away

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Team work Allow team members to manage a single environment Remote work Manage the same environment from different work places

Slide 60

Slide 60 text

Roadmap

Slide 61

Slide 61 text

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)

Slide 62

Slide 62 text

Want to help ? Contribute !

Slide 63

Slide 63 text

You are a Cloud Provider ? Test the provider on your OpenStack Report issues Ask for features

Slide 64

Slide 64 text

You are a Developer ? Test the provider Report issues Ask for features

Slide 65

Slide 65 text

You are a Developer ? Contribute Code Look for issues (We label all easy issues ‘quickwin’) Review pull requests

Slide 66

Slide 66 text

Everything is on Github github.com/ggiamarchi/vagrant-openstack-provider

Slide 67

Slide 67 text

Thank you! Questions ?