-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
54 lines (45 loc) · 1.58 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.omnibus.chef_version = :latest
config.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: [
'.vagrant/',
'.git/',
'tmp/',
'packer_cache/'
]
## AWS
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
aws.keypair_name = ENV['AWS_EC2_KEYPAIR']
aws.user_data = "#!/bin/bash\nsed -i -e 's/^Defaults.*requiretty/# Defaults requiretty/g' /etc/sudoers"
aws.region = ENV['AWS_REGION']
aws.instance_type = 'c3.large'
case ENV['AWS_REGION']
when 'ap-northeast-1'
aws.ami = 'ami-383c1956' # Amazon Linux AMI 2015.09.1 (HVM) SSD
when 'us-east-1'
aws.ami = 'ami-60b6c60a' # Amazon Linux AMI 2015.09.1 (HVM) SSD
else
raise "Unsupported region #{ENV['AWS_REGION']}"
end
aws.tags = {
'Name' => "Moodle #{ENV['PRODUCT_VERSION']} (Developed by #{ENV['USER']})"
}
override.ssh.username = "ec2-user"
override.ssh.private_key_path = ENV['AWS_EC2_KEYPASS']
end
config.ssh.pty = true
## Sction Provisioning
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe 'simplelog_handler::default'
chef.add_recipe 'lw1_moodle::default'
end
end