Question

On my team, we're using vagrant for both development (dev) and production (web).

It works great, but sometimes, my team will accidentally run vagrant halt to halt their dev server, but this also brings down the production (web) server. Yikes!

Is there anyway for me to prevent them from halting the production server? Like disabling the command or password protecting?

Was it helpful?

Solution

vagrant-managed-servers plugin might help when using Vagrant with production servers.

OTHER TIPS

Try adding the following to the top of your Vagrantfile:

Vagrant.configure("2") do |config|
    if ARGV[0] == 'halt'
      if ARGV[1] != 'dev'
        puts "Sorry! No way I am letting you do that!"
        ARGV.clear
      end
    end
end

What this does is it looks at the command line arguments supplied to Vagrant and if you just run vagrant halt it will not allow it to happen. If you run vagrant halt dev however it would allow the command through and it would halt only the box called dev

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top