Solaris 11 base box for Vagrant using Packer

13
Solaris 11 Base Box MSOSUG 18th Feb 2014 Alan Chalmers http://resilvered.blogspot.com.au/ @bigal Wednesday, 19 February 14

description

Solaris 11 base box for Vagrant using Packer.

Transcript of Solaris 11 base box for Vagrant using Packer

Page 1: Solaris 11 base box for Vagrant using Packer

Solaris 11 Base BoxMSOSUG 18th Feb 2014

Alan Chalmershttp://resilvered.blogspot.com.au/

@bigal

Wednesday, 19 February 14

Page 2: Solaris 11 base box for Vagrant using Packer

Vagrant

• a tool for building and distributing working environments

• development started in 2010

• wrapper around virtualbox

• supports additional hypervisors or providers

• https://www.vagrantup.com/

Wednesday, 19 February 14

Page 3: Solaris 11 base box for Vagrant using Packer

Base Box

• A basic unit of OS for Vagrant

• http://www.vagrantbox.es/ + others

Wednesday, 19 February 14

Page 4: Solaris 11 base box for Vagrant using Packer

Vagrant anatomy

Base box

Vagrant File Project VM

Vagrant File

Vagrant File

Project VM

Project VM

Wednesday, 19 February 14

Page 5: Solaris 11 base box for Vagrant using Packer

Packeramazon web services

virtual box

vmwareand more

• Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

• www.packer.io

Wednesday, 19 February 14

Page 6: Solaris 11 base box for Vagrant using Packer

Packer File

• json

• Builders

• Provisioners

• Post Processors

Wednesday, 19 February 14

Page 7: Solaris 11 base box for Vagrant using Packer

builder

{    "builders":  [        {            "boot_command":  [  boot  command  goes  here]            "boot_wait":  "95s",            "disk_size":  40960,            "guest_os_type":  "OpenSolaris_64",            "iso_checksum":  "1d0efbffe1b194959c1a3d3c8b8d801411c54278",            "iso_checksum_type":  "sha1",            "iso_url":  "file:///ISO/Oracle/sol-­‐11_1-­‐text-­‐x86.iso",            "output_directory":  "packer-­‐solaris11-­‐virtualbox",            "shutdown_command":  "sudo  /usr/sbin/shutdown  -­‐g  0  -­‐y  -­‐i  5",            "ssh_password":  "1vagrant",            "ssh_port":  22,            "ssh_username":  "vagrant",            "type":  "virtualbox-­‐iso",  

Wednesday, 19 February 14

Page 8: Solaris 11 base box for Vagrant using Packer

builder            "vboxmanage":  [                [                    "modifyvm",                    "{{.Name}}",                    "-­‐-­‐memory",                    "1024"                ],                [                    "modifyvm",                    "{{.Name}}",                    "-­‐-­‐cpus",                    "1"                ]            ],            "virtualbox_version_file":  ".vbox_version",            "vm_name":  "packer-­‐solaris-­‐11"        }}

Wednesday, 19 February 14

Page 9: Solaris 11 base box for Vagrant using Packer

builder"boot_command":  [                "27<enter><wait>",                "3<enter><wait10>",                "<wait10><wait10><wait10><wait10><wait10>",                "1<enter><wait10><wait10>",                "<f2><wait><wait><wait>",                "<f2><wait>",                "<f2><wait>",                "<f2><wait>",                "-­‐vagrant<wait><tab>",                "<f2><wait>",                "<tab><tab><tab><tab><tab><tab><tab><wait>",                "<f2><wait>",..                "vagrant<enter><wait>",                "1vagrant<enter><wait>",                "sudo  bash<enter><wait>",        "1vagrant<enter><wait>",                "echo  'vagrant  ALL=(ALL)  NOPASSWD:  ALL'  >>  /etc/sudoers<enter><wait>",         "/usr/gnu/bin/sed   -­‐i   's/^.*requiretty/#Defaults   requiretty/'   /etc/sudoers<enter><wait>",                "exit<enter><wait>"            ],

Wednesday, 19 February 14

Page 10: Solaris 11 base box for Vagrant using Packer

provisioner

   "provisioners":  [        {            "execute_command":  "echo  'vagrant'  |  {{.Vars}}  sudo  -­‐S  -­‐E  bash  '{{.Path}}'",            "scripts":  [                "scripts/solaris/vmtools.sh",                "scripts/solaris/postinstall.sh"            ],            "type":  "shell"        }    ]

Wednesday, 19 February 14

Page 11: Solaris 11 base box for Vagrant using Packer

post-processor

   "post-­‐processors":  [        {            "compression_level":  9,            "output":  "../builds/{{.Provider}}/solaris11.box",            "type":  "vagrant"        }    ],

Wednesday, 19 February 14

Page 12: Solaris 11 base box for Vagrant using Packer

packer build

packer build -only=virtualbox-iso solaris11.json

Wednesday, 19 February 14

Page 13: Solaris 11 base box for Vagrant using Packer

Quick Demo

• Questions to @bigal

• http://resilvered.blogspot.com.au/

• https://github.com/Alanc-au/packer

Wednesday, 19 February 14