TroodoN-Mike
TroodoN-Mike

Reputation: 16175

Vagrant adding extra parameters/options

I would like add extra arguments via command line when running/starting vagrant

For example:

vagrant up extraParam=test

Above command would start up vagrant and run puppet with extraParam as a variable

I know how to pass argument to puppet which is:

config.vm.provision :puppet do |puppet|
    puppet.facter = {
        "extraParam" => "extraParamValue"
    }
}

Is that possible? Maybe at least as --option=extraParam but how do I access that via vagrant?

Upvotes: 0

Views: 717

Answers (1)

geerlingguy
geerlingguy

Reputation: 4802

Unfortunately, this seems to not be possible at this time, at least not simply. This answer seems to have a helpful suggestion, but still requires extra work in your Vagrantfile or provisioning config.

The only options available to the vagrant provision command are:

$ vagrant provision -h
Usage: vagrant provision [vm-name] [--provision-with x,y,z]
    --provision-with x,y,z       Enable only certain provisioners, by type.
    --[no-]parallel              Enable or disable parallelism if provider supports it.
    -h, --help                   Print this help

What I do, instead, is edit the Vagrantfile while working on a specific feature (in my case, I use Ansible, and its tagging functionality to only run one set of plays (using tags)), and add in the argument I wish to pass within the provisioner definition block.

Upvotes: 1

Related Questions