I am using Vagrant to deploy VMs for development. One of the requirements is that vagrant provision
creates a new user (done in a provisioning script I wrote) and then vagrant ssh
connects to the box as that user.
I cannot figure out how to tell if the box has been provisioned or not.
I see that the Vagrant provisioning code sets env[:provision_enabled]
if this run is supposed to be doing provisioning, so I thought I would be able to do something like this:
if env[:provision_enabled]
config.ssh.username = "#{data['ssh']['provision_username']}"
else
config.ssh.username = "#{data['ssh']['username']}"
end
The idea is that SSH connections for provisioning would use one connection and SSH connections for everything else would use the other.
However, env[:provision_enabled]
does not appear to be accessible in the Vagrantfile
.
Is there a way to do this?