Vagrant & Packer
RAX Hack Night

So…

I automated *all* the things

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…
Feel quite smug about it

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…
Got my environments in order
DEV

QA

PROD

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…

All is good

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…

OR IS IT?!?!

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So…

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So… the problem

How do you get your DEVs
mobile?

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So… the problem

Have a dev portable platform!
that is the *SAME* everywhere

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
So… the problem

Why the hell they all work from
Starbucks?!?!?

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Vagrant!

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Vagrant!
You have a base Box VM
Add some script sprinkles
Attach to chef or Puppet!
or something else

RACKSPACE® HOSTING
...
Base Box
You have a base Box

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Base Box
Where can I run this Base Box?
VirtualBox!
VMWare Fusion!
VMWare Workstation

RACKSPACE® HOSTING

|

WWW.RACKSPAC...
Base Box
Where can I run this Base Box?
Rackspace Cloud!
Amazon!
OpenStack

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Base Box
As simple as 1…2…3…
vagrant	
  box	
  add	
  $title	
  $BOX_URL	
  
vagrant	
  init	
  $title	
  
vagrant	
  up

...
Plugins!
ansible	
  
vagrant-­‐berkshelf	
  
vagrant-­‐librarian-­‐puppet	
  
vagrant-­‐lxc	
  
vagrant-­‐salt
RACKSPACE® ...
Vagrantfile

Defines what Vagrant will do

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Vagrantfile
Vagrant.configure("2")	
  do	
  |config|	
  
	
  	
  	
  	
  config.vm.box	
  =	
  "precise64"	
  
	
  	
  	
  ...
Vagrantfile
Vagrant.configure("2")	
  do	
  |config|	
  
	
  	
  	
  	
  config.vm.box	
  =	
  "precise64"	
  
	
  	
  	
  ...
Taking this to 11!

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Taking this to 11!
Vagrant.configure("2")	
  do	
  |config|	
  
	
  	
  config.vm.provision	
  "shell",	
  inline:	
  "ech...
Taking this to 11!

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
And now…

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
And now…

Packer!

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer

Do your GMs RIGHT

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer
Add that Puppet!
you always!
wanted

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer

From a single config file

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer

Deploy EVERYWHERE

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer
Amazon AWS!
Digital Ocean!
OpenStack!
VMWare
RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer
{	
  
	
  	
  "builders":	
  [{	
  
	
  	
  	
  	
  "type":	
  "amazon-­‐ebs",	
  
	
  	
  	
  	
  "access_key":	
 ...
Packer
$	
  packer	
  build	
  example.json	
  
==>	
  amazon-­‐ebs:	
  amazon-­‐ebs	
  output	
  will	
  be	
  in	
  this...
Packer
Deploy to more than one!
provider at the same time!
using the “builders” array

RACKSPACE® HOSTING

|

WWW.RACKSPAC...
Packer
$	
  packer	
  build	
  example.json	
  
==>	
  amazon-­‐ebs:	
  amazon-­‐ebs	
  output	
  will	
  be	
  in	
  this...
Packer
Also deploy to Vagrant!
using the “post-processors”!
array

RACKSPACE® HOSTING

|

WWW.RACKSPACE.CO.UK
Packer
{	
  
	
  	
  "builders":	
  [...],	
  

!
	
  	
  "provisioners":	
  [...],	
  

!
	
  	
  "post-­‐processors":	
 ...
RACKSPACE® HOSTING
|
UK SALES: +44 (0)20 8712 6507

RACKSPACE® HOSTING

|

© RACKSPACE US, INC.

|

5 MILLINGTON ROAD
|
HA...
Upcoming SlideShare
Loading in …5
×

Rackspace Hack Night - Vagrant & Packer

1,808 views

Published on

Published in: Technology, Business
4 Comments
5 Likes
Statistics
Notes
  • Free Download : http://gg.gg/114bb
    Hi I just wanna share something to you guys..
    I am using a great tool, as of now it is still
    working perfect.. you can download the full file
    for free here
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Free Download : https://www.mediafire.com/?8nz717bo19i6uv7
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • http://airfiles.net/file/d3b7a81a1bff
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Free Download : http://gg.gg/114bb

    Hey Guyz and girls, Today I am gonna show you perfact tool, Remember This video is old, But the download link with hack is brand new. Its very simple to using this tool and here are some instructions in video. Please REDOWNLOAD. Don't Forget to Comment Subscribe & Rate My Video :)

    Virus Scan :- This file has been scanned with avast! Antivirus. -- Status: FILE IS CLEANN.

    Copyright © 2014. All Rights Reserved
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
1,808
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
24
Comments
4
Likes
5
Embeds 0
No embeds

No notes for slide

Rackspace Hack Night - Vagrant & Packer

  1. 1. 
 Vagrant & Packer RAX Hack Night

  2. 2. So… I automated *all* the things RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  3. 3. So… Feel quite smug about it RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  4. 4. So… Got my environments in order DEV QA PROD RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  5. 5. So… All is good RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  6. 6. So… OR IS IT?!?! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  7. 7. So… RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  8. 8. So… RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  9. 9. So… the problem How do you get your DEVs mobile? RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  10. 10. So… the problem Have a dev portable platform! that is the *SAME* everywhere RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  11. 11. So… the problem Why the hell they all work from Starbucks?!?!? RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  12. 12. Vagrant! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  13. 13. Vagrant! You have a base Box VM Add some script sprinkles Attach to chef or Puppet! or something else RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  14. 14. Base Box You have a base Box RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  15. 15. Base Box Where can I run this Base Box? VirtualBox! VMWare Fusion! VMWare Workstation RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  16. 16. Base Box Where can I run this Base Box? Rackspace Cloud! Amazon! OpenStack RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  17. 17. Base Box As simple as 1…2…3… vagrant  box  add  $title  $BOX_URL   vagrant  init  $title   vagrant  up RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  18. 18. Plugins! ansible   vagrant-­‐berkshelf   vagrant-­‐librarian-­‐puppet   vagrant-­‐lxc   vagrant-­‐salt RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  19. 19. Vagrantfile Defines what Vagrant will do RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  20. 20. Vagrantfile Vagrant.configure("2")  do  |config|          config.vm.box  =  "precise64"          config.vm.box_url  =  "http://files.vagrantup.com/precise64.box"          config.vm.network  :private_network,  ip:  "192.168.33.10"          config.vm.synced_folder  "../data",  "/vagrant_data"          config.vm.provider  :virtualbox  do  |vb|                  vb.customize  ["modifyvm",  :id,  "-­‐-­‐memory",  "1024"]          end   end   ! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  21. 21. Vagrantfile Vagrant.configure("2")  do  |config|          config.vm.box  =  "precise64"          config.vm.box_url  =  "http://files.vagrantup.com/precise64.box"          config.vm.network  :private_network,  ip:  "192.168.33.10"          config.vm.provision  :puppet  do  |puppet|                  puppet.manifests_path  =  "manifests"                  puppet.manifest_file    =  "init.pp"          end     end   ! RACKSPACE® HOSTING ! | WWW.RACKSPACE.CO.UK
  22. 22. Taking this to 11! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  23. 23. Taking this to 11! Vagrant.configure("2")  do  |config|      config.vm.provision  "shell",  inline:  "echo  Hello"      config.vm.define  "web"  do  |web|          web.vm.box  =  "apache"      end      config.vm.define  "db"  do  |db|          db.vm.box  =  "mysql"      end   end   ! RACKSPACE® HOSTING ! | WWW.RACKSPACE.CO.UK
  24. 24. Taking this to 11! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  25. 25. And now… RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  26. 26. And now… Packer! RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  27. 27. Packer Do your GMs RIGHT RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  28. 28. Packer Add that Puppet! you always! wanted RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  29. 29. Packer RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  30. 30. Packer From a single config file RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  31. 31. Packer Deploy EVERYWHERE RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  32. 32. Packer Amazon AWS! Digital Ocean! OpenStack! VMWare RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  33. 33. Packer {      "builders":  [{          "type":  "amazon-­‐ebs",          "access_key":  "YOUR  KEY  HERE",          "secret_key":  "YOUR  SECRET  KEY  HERE",          "region":  "us-­‐east-­‐1",          "source_ami":  "ami-­‐de0d9eb7",          "instance_type":  "t1.micro",          "ssh_username":  "ubuntu",          "ami_name":  "packer-­‐example  {{timestamp}}"      }]   }   RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  34. 34. Packer $  packer  build  example.json   ==>  amazon-­‐ebs:  amazon-­‐ebs  output  will  be  in  this  color.   ==>  amazon-­‐ebs:  Creating  temporary  keypair  for  this  instance...   ==>  amazon-­‐ebs:  Creating  temporary  security  group  for  this  instance...   ==>  amazon-­‐ebs:  Authorizing  SSH  access  on  the  temporary  security  group...   ==>  amazon-­‐ebs:  Launching  a  source  AWS  instance...   ==>  amazon-­‐ebs:  Waiting  for  instance  to  become  ready...   ==>  amazon-­‐ebs:  Connecting  to  the  instance  via  SSH...   ==>  amazon-­‐ebs:  Stopping  the  source  instance...   ==>  amazon-­‐ebs:  Waiting  for  the  instance  to  stop...   ==>  amazon-­‐ebs:  Creating  the  AMI:  packer-­‐example  1371856345   ==>  amazon-­‐ebs:  AMI:  ami-­‐19601070   ==>  amazon-­‐ebs:  Waiting  for  AMI  to  become  ready...   ==>  amazon-­‐ebs:  Terminating  the  source  AWS  instance...   ==>  amazon-­‐ebs:  Deleting  temporary  security  group...   ==>  amazon-­‐ebs:  Deleting  temporary  keypair...   ==>  amazon-­‐ebs:  Build  finished.   ! ==>  Builds  finished.  The  artifacts  of  successful  builds  are:   -­‐-­‐>  amazon-­‐ebs:  AMIs  were  created:   ! us-­‐east-­‐1:  ami-­‐19601070   RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  35. 35. Packer Deploy to more than one! provider at the same time! using the “builders” array RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  36. 36. Packer $  packer  build  example.json   ==>  amazon-­‐ebs:  amazon-­‐ebs  output  will  be  in  this  color.   ==>  digitalocean:  digitalocean  output  will  be  in  this  color.   ! ==>  digitalocean:  Creating  temporary  ssh  key  for  droplet...   ==>  amazon-­‐ebs:  Creating  temporary  keypair  for  this  instance...   ==>  amazon-­‐ebs:  Creating  temporary  security  group  for  this  instance...   ==>  digitalocean:  Creating  droplet...   ==>  amazon-­‐ebs:  Authorizing  SSH  access  on  the  temporary  security  group...   ==>  amazon-­‐ebs:  Launching  a  source  AWS  instance...   ==>  digitalocean:  Waiting  for  droplet  to  become  active...   ==>  amazon-­‐ebs:  Waiting  for  instance  to  become  ready...   ==>  digitalocean:  Connecting  to  the  droplet  via  SSH...   ==>  amazon-­‐ebs:  Connecting  to  the  instance  via  SSH...   ...   ==>  Builds  finished.  The  artifacts  of  successful  builds  are:   -­‐-­‐>  amazon-­‐ebs:  AMIs  were  created:   ! us-­‐east-­‐1:  ami-­‐376d1d5e   -­‐-­‐>  digitalocean:  A  snapshot  was  created:  packer-­‐1371870364   RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  37. 37. Packer Also deploy to Vagrant! using the “post-processors”! array RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  38. 38. Packer {      "builders":  [...],   !    "provisioners":  [...],   !    "post-­‐processors":  ["vagrant"]   } RACKSPACE® HOSTING | WWW.RACKSPACE.CO.UK
  39. 39. RACKSPACE® HOSTING | UK SALES: +44 (0)20 8712 6507 RACKSPACE® HOSTING | © RACKSPACE US, INC. | 5 MILLINGTON ROAD | HAYES, UNITED KINGDOM UB3 4AZ | UK SUPPORT: 0800 988 0300 | WWW.RACKSPACE.CO.UK RACKSPACE® AND FANATICAL SUPPORT® ARE SERVICE MARKS OF RACKSPACE US, INC. REGISTERED IN THE UNITED STATES AND OTHER COUNTRIES. | WWW.RACKSPACE.CO.UK !39

×