Skip to content

Instantly share code, notes, and snippets.

@trilitheus
Created March 28, 2017 16:10
Show Gist options
  • Save trilitheus/59c39a764a4688acb6188282e4aef290 to your computer and use it in GitHub Desktop.
Save trilitheus/59c39a764a4688acb6188282e4aef290 to your computer and use it in GitHub Desktop.
packer vbox
{
"variables": {
"HOME": "{{env `HOME`}}",
"USER": "{{env `USER`}}",
"build_timestamp": "{{isotime \"20060102150405\"}}",
"vm_name": "centos7"
},
"builders": [{
"type": "vmware-iso",
"http_directory": "kickstart",
"boot_command": [
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg<enter><wait>"
],
"type": "virtualbox-iso",
"boot_wait": "5s",
"guest_os_type": "RedHat_64",
"disk_size": 61440,
"iso_url": "http://repo.bigstepcloud.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso",
"iso_checksum": "27bd866242ee058b7a5754e83d8ee8403e216b93d130d800852a96f41c34d86a",
"iso_checksum_type": "sha256",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "10000s",
"output_directory": "{{user `HOME`}}/packer_vbox_builds/{{user `build_timestamp`}}",
"shutdown_command": "echo '{{user `USER`}}' | sudo -S shutdown -P now",
"name": "{{user `vm_name`}}"
}],
"provisioners": [{
"type": "chef-solo",
"cookbook_paths": ["cookbooks"],
"run_list": ["recipe[base_hardening::default]"]
}, {
"type": "shell",
"environment_vars": [
"HOME_DIR=/home/vagrant"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"scripts": [
"scripts/vagrant.sh",
"scripts/install_vbox_guest_additions.sh"
]
}],
"post-processors": [{
"type": "vagrant"
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment