Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Vagrant | Plugin | vagrant-global-statusで仮想環境の一覧を表示

概要

vagrant-global-statusで仮想環境の一覧を表示

詳細

vagrant-global-statusで仮想環境の一覧を表示

インストール
vagrant plugin install vagrant-global-status

インストールの確認

$ vagrant plugin list | grep vagrant-global-status
Installing the 'vagrant-global-status' plugin. This can take a few minutes...
Installed the plugin 'vagrant-global-status (0.1.4)'!
試行
# 何かVMを起動しておく
$ vagrant up

# 起動中のVMを一覧表示する
$ vagrant global-status -a

D:/xxxxx/sample
  default      running      (virtualbox)   2014-02-28 21:42:13 +0900
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.provider :virtualbox do |vb|
    vb.name = "sample_box_template"
  end
  config.vm.box = "ubuntu-12.04-x64"
  config.vm.provision "shell", inline: <<-EOS
sudo apt-get install git -y
sudo apt-get install figlet -y
figlet 'provision success!'
  EOS
end
おまけ

vagrant global-statusのヘルプ

$ vagrant global-status -h
Usage: vagrant global-status [--all]
    -a, --all                        Displays information about all machines (instead of just the active ones)
    -h, --help                       Print this help