Last active
August 29, 2015 14:06
-
-
Save knakayama/05182870b52bdb51374e to your computer and use it in GitHub Desktop.
vagrant test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # vim: set ft=ruby | |
| VAGRANTFILE_API_VERSION = "2" | |
| $script = <<EOT | |
| sudo cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime | |
| sudo yum -y update | |
| EOT | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| config.vm.box = "ec2" | |
| config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box" | |
| config.vm.synced_folder ".", "/vagrant", disabled: true | |
| config.vm.provider :aws do |aws, override| | |
| override.ssh.username = "ec2-user" | |
| override.ssh.private_key_path = "~/.ssh/test-key.pem" | |
| override.ssh.pty = false | |
| aws.access_key_id = ENV['AWS_ACCESS_KEY_ID'] | |
| aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY_ID'] | |
| aws.keypair_name = "test-key" | |
| aws.region = "ap-northeast-1" | |
| aws.ami = "ami-29dc9228" | |
| aws.instance_type = "t2.micro" | |
| aws.security_groups = ["general-security-group"] | |
| aws.tags = { | |
| 'Name' => 'vagrant-test', | |
| 'Description' => 'vagrant test', | |
| } | |
| aws.user_data = <<EOT | |
| #!/bin/sh | |
| echo "Defaults !requiretty" > /etc/sudoers.d/vagrant-init | |
| chmod 440 /etc/sudoers.d/vagrant-init | |
| EOT | |
| end | |
| config.vm.provision "shell", inline: $script | |
| config.vm.provision :chef_solo do |chef| | |
| chef.cookbooks_path = ["./cookbooks"] | |
| chef.add_recipe "sandbox" | |
| end | |
| #config.vm.provision :configspec do |spec| | |
| # spec.pattern = 'configspec/*_spec.rb' | |
| #end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment