vagrant-reload
Reloads and re-provisions Vagrant machine
TLDR
Reload the currently running machine
Target a machine by name or ID
Force the provisioners to run
SYNOPSIS
vagrant reload [vm-name] [options]
PARAMETERS
vm-name
Specifies a particular virtual machine to reload. If omitted, Vagrant will attempt to reload all defined machines in the Vagrantfile.
--no-provision
Skips the provisioning step. The machine will restart, but provisioners will not be re-run.
--provision-with x,y,z
Specifies which provisioners to run. You can specify a comma-separated list of provisioner names (as defined in your Vagrantfile).
-p, --provision
Forces the provisioning step to run, even if the machine has already been provisioned before. This is the default behavior for reload.
DESCRIPTION
The vagrant reload command is used to restart a Vagrant machine, applying any configuration changes that have been made to the Vagrantfile since the last vagrant up or vagrant provision. It essentially performs a vagrant halt followed by a vagrant up, but with an added provisioning step by default.
This command is particularly useful when you have modified machine-level configurations in your Vagrantfile, such as network settings (e.g., forwarded ports, private networks), memory allocation, CPU count, or other provider-specific settings that require a machine restart to take effect. By default, it also re-runs the provisioners, ensuring the guest OS is in the desired state, which can be skipped using the --no-provision flag.
vagrant reload provides a convenient and streamlined workflow, saving users from manually executing vagrant halt, then vagrant up, and potentially vagrant provision separately.
CAVEATS
When using vagrant reload, be aware that it performs a hard restart of the VM. Any in-memory state or running processes not configured to persist will be lost.
If extensive provisioning is configured, the command can take a significant amount of time to complete. Always review your Vagrantfile for changes before reloading, especially those related to network configurations which might lead to new IP addresses or connectivity issues if not correctly managed.
WHEN TO USE <B>VAGRANT RELOAD</B>
Use vagrant reload primarily after making changes to machine-level settings in your Vagrantfile, such as network configurations (e.g., private_network, forwarded_port), resource allocations (e.g., config.vm.memory, config.vm.cpus), or provider-specific settings. It's also useful if you need to re-run your provisioners on a running machine, especially if previous provisioning failed or if your provisioning scripts have been updated.
DIFFERENCE FROM <B>VAGRANT HALT</B> + <B>VAGRANT UP</B>
While vagrant reload internally performs a halt and then an up, its key distinction is that it always runs provisioners by default (unless --no-provision is used). In contrast, vagrant up will only run provisioners if the machine is being started for the first time or if forced with --provision after an explicit vagrant halt.
HISTORY
The vagrant reload command has been a fundamental part of Vagrant since its early versions, evolving alongside the platform's capabilities. Its introduction addressed the common development workflow need to apply Vagrantfile configuration changes that demand a machine restart (e.g., memory, network interfaces) without resorting to the more disruptive vagrant destroy and vagrant up cycle. Its default behavior of also running provisioners makes it a go-to command for ensuring the machine's software environment is up-to-date after core configuration adjustments, streamlining the iteration process for developers.


