- VirtualBox
- Vagrant
- Packer
- a Mac with a lot of Memory/CPU/Disk
- great Templates/Tools from https://github.com/timsutton/osx-vm-templates
-
Open OSX App Store, download Yosemite. Once the download is finished, the installer starts. Close it right away.
-
Execute:
mkdir /tmp/osxvm cd /tmp/osxvm git clone https://github.com/timsutton/osx-vm-templates cd osx-vm-templates sudo prepare_iso/prepare_iso.sh "/Applications/Install OS X Yosemite.app" out # note result .dmg filename md5 out/OSX_InstallESD_10.10.3_14D136.dmg # note result checksum cd packer
-
For use with test-kitchen we want a base image without chef, puppet, other stuff. Also we're only going to build the virtualbox image. Open the
template.json
file and adjust:
--- i/packer/template.json
+++ w/packer/template.json
@@ -101,11 +101,7 @@
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"../scripts/vagrant.sh",
- "../scripts/vmware.sh",
- "../scripts/parallels.sh",
"../scripts/xcode-cli-tools.sh",
- "../scripts/chef-omnibus.sh",
- "../scripts/puppet.sh",
"../scripts/add-network-interface-detection.sh",
"../scripts/autologin.sh",
"../scripts/system-update.sh",
-
Start packer. This will take a lot of time and disk space (10+ GB)
# update filename and checksum! packer build \ -var iso_url=../out/OSX_InstallESD_10.10.3_14D136.dmg \ -var iso_checksum=3d379eb82fd8417974aa94d76157d511 \ -var username=vagrant \ -var password=vagrant \ -var autologin=true \ -var install_vagrant_keys=true \ -except vmware-iso,parallels-iso \ template.json
-
Import box to Vagrant
vagrant box add packer_virtualbox-iso_virtualbox.box --name macosx-10.10
-
Enjoy test-kitchen
.kitchen.yml:
---
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: macosx-10.10
suites:
- name: default
run_list:
- recipe[your-cookbook::default]
attributes:
Vagrant seems to have a bug, that will be fixed soon:
Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
Vagrant is configured to generate a random keypair and insert it
onto the guest machine, but it appears Vagrant doesn't know how to do
this with your guest OS. Please disable key insertion by setting
`config.ssh.insert_key = false` in the Vagrantfile.
After doing so, run `vagrant reload` for the setting to take effect.
If you'd like Vagrant to learn how to insert keys on this OS, please
open an issue with details about your environment.
You can find the Vagrantfile(s) inside .kitchen
, add config.ssh.insert_key = false
and execute vagrant reload
in each directory containing a Vagrantfile
.
Tested on: 2015-05-28
Tested with:
- VirtualBox 4.3.28
- Vagrant 1.7.2
- Packer v0.7.5
- OSX 10.10.3_14D136
- timsutton/osx-vm-templates@ 0cad0b939b65e790f7cb5549f460dfa4cc273bbc
👍 for both :-)