已定义vagrant主框,但命令仍针对所有框运行

已定义vagrant主框,但命令仍针对所有框运行,vagrant,Vagrant,我正在尝试将我的“dev”VM设置为主VM,以便大多数命令(如vagrant up,vagrant halt)在“dev”VM上运行,并忽略“stage”VM,除非命令行上明确列出了“stage”VM名称。这是我的vagrant文件,但是当我运行vagrant up时,两个vm都会被启动,而不仅仅是“dev” 主标志似乎只适用于我的vagrant ssh 在过去,我使用了以下方法来解决这个问题 # stage box intended for configuration closely matc

我正在尝试将我的“dev”VM设置为主VM,以便大多数命令(如
vagrant up
vagrant halt
)在“dev”VM上运行,并忽略“stage”VM,除非命令行上明确列出了“stage”VM名称。这是我的vagrant文件,但是当我运行
vagrant up
时,两个vm都会被启动,而不仅仅是“dev”


主标志似乎只适用于我的
vagrant ssh

在过去,我使用了以下方法来解决这个问题

# stage box intended for configuration closely matching production
if ARGV[1] == 'stage'
    config.vm.define "stage" do |stage|
        box_setup stage, \
        "10.9.8.31", "deploy/playbook_full_stack.yml", "deploy/hosts/vagrant_stage.yml"
    end
end
# stage box intended for configuration closely matching production
if ARGV[1] == 'stage'
    config.vm.define "stage" do |stage|
        box_setup stage, \
        "10.9.8.31", "deploy/playbook_full_stack.yml", "deploy/hosts/vagrant_stage.yml"
    end
end