0

When my VM is not created, I can run:

vagrant up

or:

vagrant up --provision

but not vagrant provision, because of the warning:

VM not created. Moving on...

When my VM is created, I can run:

vagrant provision

or:

vagrant reload --provision

but not vagrant up --provision, because of the warning:

The machine is already created.

When I run vagrant up && vagrant provision, it will be provisioned twice if VM machine hasn't been created yet.

Also I can't check for the non-zero exit code of above commands to run another, because they're always returning zero.

Is there any single vagrant command which will invoke the provision script every time when I run the command independently of the VM state (whether it is created or not)?

kenorb
  • 6,499
  • 2
  • 46
  • 54

1 Answers1

1

This isn't a single command, but perhaps this will work:

$ vagrant up --no-provision && vagrant provision
EEAA
  • 109,363
  • 18
  • 175
  • 245