LoginSignup
13
13

More than 5 years have passed since last update.

vagrant-global-statusを入れた

Last updated at Posted at 2013-11-05

早速やってみる

vagrant plugin install vagrant-global-status

けど、
インストール直後、早速

vagrant global-status -a

してみたけど何も表示されない。
公式のREADMEを読んでみると、こんな記述が。

Whenever you vagrant up a VM, the plugin will register the machine name and path to its Vagrantfile on a global state file under ~/.vagrant.d. That is enough information for the global-status command to do its job and parse machine's statuses.
After a vagrant destroy, the VM will get removed from the global state file and will no longer show up by default on vagrant global-status unless you pass in -a to it.

vagrant upをフックして、vagrant.d以下に立ち上げたVMのパスやステータスを保存している模様。
実際にvagrant upして「.~/.vagrant.d」以下の様子を見てみると、2つのファイルが更新されていた。

  • plugins.json

  • machine-environments.json

「machine-environments.json」のほうにVMの情報が記載されてました。

machine-environments.json
{"environments":{"C:/Users/jacoyutorius/vagrant_berks":{"machines"[{"name":"default"}]}}}

こんな感じで。
このあと、再度vagrant global-status -a やってみたらVMの情報がしっかり表示されました。

参考にしたサイト

Vagrantで仮想マシンの一覧を簡単に取得する方法

vagrant-global-status

13
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13