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)?
This isn't a single command, but perhaps this will work: