LoginSignup
6
3

More than 5 years have passed since last update.

体育会系 IDCF Cloud の仮想マシンを Vagrant 経由で起動する手順

Last updated at Posted at 2016-04-06

参考

有難うございます。

事前の準備

  • 東日本又は西日本リージョンの API エンドポイントを確認しておく
  • API キーを確認しておく
  • Secret キーを確認しておく
  • SSH key にて鍵を発行しておく
  • IP アドレスの ID を確認しておく
  • Vagrant の導入、vagrant-cloudstack の導入

本記事の環境について

vagrant を実行する環境

vagrantを実行する環境
ProductName:    Mac OS X
ProductVersion: 10.11.4
BuildVersion:   15E49a

vagrant のバージョン

vagrantのバージョン
Installed Version: 1.8.1
Latest Version: 1.8.1

vagrant-cloudstack の導入

command
vagrant plugin install vagrant-cloudstack

Vagrantfile の作成

作業ディレクトリの作成

command
mkdir ~/path/to/vagrant_idcf

vagrant init

command
cd ~/path/to/vagrant_idcf
vagrant init

vagrant init を実行すると Vagrantfile が生成される。

Vagrantfile

Vagrantfile
#
# 西日本リージョンにて仮想マシンを起動する例
#
Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"

  config.vm.provider :cloudstack do |cloudstack, override|
    override.vm.box = "dummy"
    override.vm.box_url = "https://github.com/klarna/vagrant-cloudstack/raw/master/dummy.box"

    cloudstack.host                  = "compute.jp-west.idcfcloud.com"
    cloudstack.path                  = "/client/api"
    cloudstack.port                  = "443"
    cloudstack.scheme                = "https"
    cloudstack.api_key               = "API キー"
    cloudstack.secret_key            = "Secret キー"

    cloudstack.display_name          = "ubuntu"
    cloudstack.template_name         = "Ubuntu Server 14.04 LTS 64-bit"
    cloudstack.zone_name             = "augusta"
    cloudstack.service_offering_name = "light.S1"

    cloudstack.pf_ip_address_id      = "IP アドレスの ID"
    cloudstack.pf_public_port        = "22"
    cloudstack.pf_private_port       = "22"
    cloudstack.keypair               = "SSH 鍵名"
    override.ssh.private_key_path    = "SSH 秘密鍵ファイルへのパス"
    override.ssh.username            = "root"
  end
end

仮想マシンの起動、ログイン、停止、破棄

仮想マシンの起動

command
vagrant up --provider cloudstack 

仮想マシンへのログイン

command
vagrant ssh

仮想マシンの停止

command
vagrant halt

仮想マシンの破棄

command
vagrant destroy

以上

IDCF Cloud を Vagrant 経由で起動する手順でした。

6
3
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
6
3