Cristovao Verstraeten – a pleasant view
Building (localized)
Vagrant boxes with
Packer
Cristovao Verstraeten – a pleasant view
About
Independent WordPress consultant.
Proponent of DevOps with emphasis on
collaboration, development practices and
improvements. Autodidact and inquisitive by
nature, committed to being informed of new
developments and technologies. Open
Source Software enthusiast.
Twitter: @apleasantview
Linkedin: cverstraeten
Web: http://apleasantview.com
Cristovao Verstraeten – a pleasant view
1 Introduction
Input =
Configuration files, localized and
provisioned with default packages
for use with Vagrant / VirtualBox
Output =
Reusable Vagrant box that is
localized and configured with
default packages
Cristovao Verstraeten – a pleasant view
1.2 Tools
Cristovao Verstraeten – a pleasant view
2. Packer Template Overview
1. Builder
Creates the VirtualBox ISO image
2. Provisioner
Provisions the box with a set of scripts
3. Post-Processor
Creates our Vagrant box
Cristovao Verstraeten – a pleasant view
2.1 Builder
Cristovao Verstraeten – a pleasant view
2.1.1 Builder Notes
● The “boot_command” kicks off the installation
● Fully automated installation of Ubuntu is done
from a preseed file
Cristovao Verstraeten – a pleasant view
2.2 Provisioner
Cristovao Verstraeten – a pleasant view
2.2.1 Provisioner Notes
● Scripts are run in the
order they have been
defined inside the
“scripts” array
● The “only” parameter
tells Packer to only
run these scripts with
the VirtualBox builder
● Convention to have a
set of individual
scripts for specific
tasks and default
packages/software
needed.
Cristovao Verstraeten – a pleasant view
2.3 Post Processor
Cristovao Verstraeten – a pleasant view
2.3.1 Post Processor Notes
● No configuration is really required, Packer
handles all that stuff for you
Cristovao Verstraeten – a pleasant view
3. Next Steps and beyond…
● Adding your box to Vagrant
● Using variables in your Packer configuration
● Using HashiCorp Atlas to build your box
Cristovao Verstraeten – a pleasant view
4 References
* Tools
Packer - https://www.packer.io/
Vagrant - https://www.vagrantup.com/
VirtualBox - https://www.virtualbox.org/
* Builder
Preseeding -
https://help.ubuntu.com/14.04/installation-guide/amd64/apb.html
http://unix.stackexchange.com/questions/139814/what-values-from-deb
VBox Manage - https://www.virtualbox.org/manual/ch08.html

Building (localized) Vagrant boxes with Packer

  • 1.
    Cristovao Verstraeten –a pleasant view Building (localized) Vagrant boxes with Packer
  • 2.
    Cristovao Verstraeten –a pleasant view About Independent WordPress consultant. Proponent of DevOps with emphasis on collaboration, development practices and improvements. Autodidact and inquisitive by nature, committed to being informed of new developments and technologies. Open Source Software enthusiast. Twitter: @apleasantview Linkedin: cverstraeten Web: http://apleasantview.com
  • 3.
    Cristovao Verstraeten –a pleasant view 1 Introduction Input = Configuration files, localized and provisioned with default packages for use with Vagrant / VirtualBox Output = Reusable Vagrant box that is localized and configured with default packages
  • 4.
    Cristovao Verstraeten –a pleasant view 1.2 Tools
  • 5.
    Cristovao Verstraeten –a pleasant view 2. Packer Template Overview 1. Builder Creates the VirtualBox ISO image 2. Provisioner Provisions the box with a set of scripts 3. Post-Processor Creates our Vagrant box
  • 6.
    Cristovao Verstraeten –a pleasant view 2.1 Builder
  • 7.
    Cristovao Verstraeten –a pleasant view 2.1.1 Builder Notes ● The “boot_command” kicks off the installation ● Fully automated installation of Ubuntu is done from a preseed file
  • 8.
    Cristovao Verstraeten –a pleasant view 2.2 Provisioner
  • 9.
    Cristovao Verstraeten –a pleasant view 2.2.1 Provisioner Notes ● Scripts are run in the order they have been defined inside the “scripts” array ● The “only” parameter tells Packer to only run these scripts with the VirtualBox builder ● Convention to have a set of individual scripts for specific tasks and default packages/software needed.
  • 10.
    Cristovao Verstraeten –a pleasant view 2.3 Post Processor
  • 11.
    Cristovao Verstraeten –a pleasant view 2.3.1 Post Processor Notes ● No configuration is really required, Packer handles all that stuff for you
  • 12.
    Cristovao Verstraeten –a pleasant view 3. Next Steps and beyond… ● Adding your box to Vagrant ● Using variables in your Packer configuration ● Using HashiCorp Atlas to build your box
  • 13.
    Cristovao Verstraeten –a pleasant view 4 References * Tools Packer - https://www.packer.io/ Vagrant - https://www.vagrantup.com/ VirtualBox - https://www.virtualbox.org/ * Builder Preseeding - https://help.ubuntu.com/14.04/installation-guide/amd64/apb.html http://unix.stackexchange.com/questions/139814/what-values-from-deb VBox Manage - https://www.virtualbox.org/manual/ch08.html