provisioner scripts are their own form of documentation. By using version control ( github, bitbucket ) you get change history for your packer templates. Version control systems allow you to review code prior to merging changes into your Packer templates. The running of Packer template builds can be automated by CI systems, like Jenkins.
as JSON text files. Packer templates are broken into the following sections: Builders Provisioners ( optional ) Post-Processors ( optional ) Variables ( optional )
generating images or virtual machines on various platforms. Builders are the only required section in a packer template. { "builders": [ { "type": "vmware-iso", "iso_url": "http://old-releases.ubuntu.com/releases/precise/ubuntu-12.04.2-server-amd64.iso", "iso_checksum": "af5f788aee1b32c4b2634734309cc9e9", "iso_checksum_type": "md5", "ssh_username": "packer", "shutdown_command": "shutdown -P now" } ] }
Shell, Local Shell, File Uploads, PowerShell, Windows Shell, Ansible Local, Ansible Remote, Chef Client, Chef Solo, Puppet Masterless, Puppet Server, Salt, Windows Restart
from the command line when building a template using the -var flag. $ packer build \ -var 'packer_esxi_host=192.168.1.51' \ -var 'packer_esxi_username=root' \ -var 'packer_esxi_password=P@ssword123' \ template.json
set from an external JSON file using the -var-file flag. A sample JSON file would contain: Assuming this file was named variables.json we could build our template using the following command: { "packer_esxi_host": "192.168.1.51" "packer_esxi_username": "root" "packer_esxi_password": "P@ssword123" } $ packer build -var-file=variables.json template.json