LoginSignup
2
1

More than 5 years have passed since last update.

OpenStackをVagrantから使う

Last updated at Posted at 2018-12-22

前提

以下の環境にて動作確認
- Vagrantは1.8.1
- クライアントはMac OSX El Capitan
- OpenStack Juno

インストール手順

  • Vagrant OpenStack plug-inの導入
$ vagrant plugin install vagrant-openstack-plugin
Installing the 'vagrant-openstack-plugin' plugin. This can take a few minutes...
Installed the plugin 'vagrant-openstack-plugin (0.12.0)'!
  • dummy box の追加
$ vagrant box add dummy https://github.com/cloudbau/vagrant-openstack-plugin/raw/master/dummy.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'dummy' (v0) for provider: 
    box: Downloading: https://github.com/cloudbau/vagrant-openstack-plugin/raw/master/dummy.box
==> box: Successfully added box 'dummy' (v0) for 'openstack'!

$ vagrant box list
dummy                    (openstack, 0)
  • Vagrantfileの作成
$ echo 'require "vagrant-openstack-plugin"

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"

  # Make sure the private key from the key pair is provided
  config.ssh.private_key_path = "~/.ssh/id_rsa"

  config.vm.provider :openstack do |os|
    os.username     = "<user-name>"          # e.g. "#{ENV['OS_USERNAME']}"
    os.api_key      = "<api-key>"           # e.g. "#{ENV['OS_PASSWORD']}"
    os.flavor       = /m1.small/                # Regex or String
    os.image        = /CentOS/                 # Regex or String
    os.endpoint     = "http://<os-auth-url>/tokens"      # e.g. "#{ENV['OS_AUTH_URL']}/tokens"
    os.keypair_name = "<key-pair-name>"      # as stored in Nova
    os.ssh_username = "centos"           # login for the VM
    os.network            = "<network-name>"            # optional
    os.floating_ip        = :auto             # optional
    os.server_name = "<instance-name>"
  end
end' | tee Vagrantfile
  • 起動
$ vagrant up --provider=openstack
2
1
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
2
1