require('lx','2.0')

Who am I


  • DevOps at Seedrs.com
  • OuiShare / basic income
  • Distributed social Network Running on Pi's!

Packer


  • Template in a JSON file
  • Builder
  • Provisioner
  • Post-Processor
  • Variables

Use the source, Luke!


{
  "builders": [
    {
      "type": "virtualbox",
      "name": "virtualbox-ubuntu",
      "boot_command": [
        "<esc><esc><enter><wait><enter><wait>",
        "preseed/url=",
        "http://{{ .HTTPIP }}:{{ .HTTPPort }}",
        "/preseed.cfg",
        "<wait>hostname={{ .Name }} <wait>",
        ...
      ],
      "http_directory": "http/ubuntu/",            
      "guest_os_type": "Ubuntu_64",
      "iso_url": "http://releases.ubuntu.com/...",
      "iso_checksum": "7d335ca541fc49..",
      "iso_checksum_type": "md5",
      "ssh_username": "{{user `ssh_username`}}",
      "ssh_password": "{{user `ssh_password`}}",   
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "1024"
        ]
      ]
    },                                             
    {
      "type": "vmware",
      ...
    },
    {
      "type": "amazon-instance",
      ...
    }
  ],                                               
  "variables": {
    "timezone": "UTC",
    "ruby_version": "1.9.3-p448",
    "puppet_version": "",
    "chef_version": null,
    "ssh_username": "vagrant",
    "ssh_password": "vagrant"
    ...
  },                                               
  "provisioners": [
    {
      "type": "file",
      "source": "a/relative/path/to/a/file",
      "destination": "/tmp/file"
    },                                             
    {
      "type": "shell",
      "environment_vars": [
        "RUBY_VERSION={{user `ruby_version`}}",
        ...
      ],
      "scripts": [
        "scripts/ubuntu/base.sh",
        "scripts/common/ruby.sh",
        ...]                                       
    }
  ],                                               
  "post-processors": ["vagrant"]
}                                                  

Packer commands


  • inspect
  • validate
  • build
    • -except
    • -only
    • -var-file
    • -var 'ssh_username=requirelx'

Where to find template?


  • veewee-to-packer
  • packer distrib site:github.com
  • template repository?

packer-warehouse


Thoughts


  • Read the doc, it's great!
  • Go is really fast
  • Post issues!

Questions?

@pierreozoux