-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
72 lines (62 loc) · 2.18 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
if Vagrant::VERSION == "1.7.2"
synced_folder_files = Dir.glob(File.expand_path("../.vagrant/machines/**/synced_folders", __FILE__))
synced_folder_files.map do |synced_folder_file|
File.unlink(synced_folder_file) if File.exists?(synced_folder_file)
end
end
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' => "Cachet #{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 "file", source: ".composer/auth.json", destination: ".composer/auth.json"
config.vm.provision :chef_zero do |chef|
chef.nodes_path = "nodes"
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.json = {
"composer" => {
"owner" => "root",
"group" => "apache"
}
}
chef.add_recipe 'simplelog_handler::default'
chef.add_recipe 'cachet::pre_packages'
chef.add_recipe 'composer::default'
chef.add_recipe 'cachet::cachet'
chef.add_recipe 'cachet::setup_tasks'
end
end