Skip to content

Instantly share code, notes, and snippets.

@toruuetani
Last active August 29, 2015 14:03
Show Gist options
  • Save toruuetani/69552f805b4ea1397abc to your computer and use it in GitHub Desktop.
Save toruuetani/69552f805b4ea1397abc to your computer and use it in GitHub Desktop.
Vagrantについて調べること

動作環境

  • Windows 8.1 Pro Update 1 x64
  • VirtualBox 4.3.10
  • Vagrant Ver.1.6.3

Vagrant-Windows

https://github.com/WinRb/vagrant-windows/

Vagrant-Omnibus

https://github.com/schisamo/vagrant-omnibus

  • [DONE]Windows でも動作するか => Ver.1.4.1 で確認
  • [DONE]Chef インストーラがダウンロードされるか
  • [DONE]Chef がインストールされるか
  • [DONE]cookbookがコピーされるか
  • [DONE]レシピが適用されるか
  • [NG]インストーラのダウンロード先をローカルパスにできるか

Vagrant-AWS

https://github.com/mitchellh/vagrant-aws

  • [DONE]Windows AMI を vagrant up できるか
    • EC2インスタンスは起動するが、 ssh の接続待ちでハングアップする。
    • WinRM で接続する方法は不明
    • vagrant destroy でEC2インスタンスが Terminate されることを確認済み
  • [WIP]WinRM でネットワークアダプターを変更できるか
  • [WIP]Vagrant-Omnibus で Chef をインストールできるか
  • [DONE]dummy box 登録 => vagrant box add aws-dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
  • [DONE]アクセスキー等はVCSに登録したくないので、 Dotenv を使う。 vagrant plugin install dotenv
AWS_ACCESS_KEY_ID = "aws_access_key"
AWS_SECRET_ACCESS_KEY = "aws_secret_key"
AWS_KEYPAIR_NAME = "keypair"
AWS_SECURITY_GROUP = "security_name"
AWS_INSTANCE_NAME = "instance_name"
Dotenv.load

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "aws-dummy"
  # config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
  config.vm.synced_folder ".", "/vagrant", disabled: true

  config.vm.communicator = "winrm"
  config.winrm.username = "vagrant"
  config.winrm.password = "vagrant"

  config.vm.provider :aws do |aws, override|
    aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
    aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
    aws.keypair_name = ENV['AWS_KEYPAIR_NAME']

    aws.region = "ap-northeast-1"  # Tokyo
    aws.availability_zone = "ap-northeast-1c"

    aws.ami = "ami-6f397a6e"  # Windows_Server-2012-R2_RTM-Japanese-64Bit-Base-2014.05.20
    aws.instance_type = "t1.micro"

    aws.security_groups = ENV['AWS_SECURITY_GROUP']
    
    aws.tags = {
      'Name' => ENV['AWS_INSTANCE_NAME'],
    }
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment