Solaris 11 base box for Vagrant using Packer
-
Upload
alan-chalmers -
Category
Technology
-
view
833 -
download
0
description
Transcript of 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
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
Base Box
• A basic unit of OS for Vagrant
• http://www.vagrantbox.es/ + others
Wednesday, 19 February 14
Vagrant anatomy
Base box
Vagrant File Project VM
Vagrant File
Vagrant File
Project VM
Project VM
Wednesday, 19 February 14
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
Packer File
• json
• Builders
• Provisioners
• Post Processors
Wednesday, 19 February 14
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
builder "vboxmanage": [ [ "modifyvm", "{{.Name}}", "-‐-‐memory", "1024" ], [ "modifyvm", "{{.Name}}", "-‐-‐cpus", "1" ] ], "virtualbox_version_file": ".vbox_version", "vm_name": "packer-‐solaris-‐11" }}
Wednesday, 19 February 14
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
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
post-processor
"post-‐processors": [ { "compression_level": 9, "output": "../builds/{{.Provider}}/solaris11.box", "type": "vagrant" } ],
Wednesday, 19 February 14
packer build
packer build -only=virtualbox-iso solaris11.json
Wednesday, 19 February 14
Quick Demo
• Questions to @bigal
• http://resilvered.blogspot.com.au/
• https://github.com/Alanc-au/packer
Wednesday, 19 February 14