Skip to content

Adding custom provisioners

Calvin Krist edited this page Jun 17, 2018 · 2 revisions

What is a Provisioner?

Provisioners use scripts in order to configure virtual machines. These scripts are executed on the virtual machine, and the resulting state is part of the output file that Packer generates.

How can I add my own?

Linux machines will run the 'ubuntu/script/custom-script.sh' file on the virtual machine. Add whatever scripts you want to run to this file, and they will be executed on your machine.

Windows machines are a little more hack-ish. Full custom provisioning support is coming soon. The "windows_x64/scripts/add-users.ps1" script is run on every windows virtual machine. Add your own provisioning scripts at the end of this script.

Vagrant Integration

Packer turns an ISO into some kind of output file. This can take a long time to execute, so if you plan to test different VM configurations it is better to do provisioning through Vagrant--this executes in minutes. Thus, use Packer just to set up the basics of your virtual environment. The provisioners may only create users, or other repetitive tasks that will be constants on all of your tests.

Instead, do any provisioning that you may change through Vagrant. See this documenttion for more information on how to do that.

Clone this wiki locally