-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathVagrantfile
123 lines (88 loc) · 3.59 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
$message = <<EOT
--------------------------------------------------------------------------
Created virtual environment for IBM Storage Scale.
User Guide:
https://github.com/IBM/StorageScaleVagrant/blob/master/README.md
To logon on the management node execute:
vagrant ssh
To connect to the Storage Scale GUI, in a web browser:
https://<AWS Public IP>
--------------------------------------------------------------------------
EOT
# Set provider
$StorageScaleVagrant_provider = 'AWS'
# Read AWS credentials and ssh keys from shared configuration file
load File.expand_path('../Vagrantfile.aws-credentials', __FILE__)
# Read AWS AMI ID of the StorageScale_base AMI from the configuration file
load File.expand_path('../Vagrantfile.aws-ami', __FILE__)
# Load common settings
load File.expand_path('../../shared/Vagrantfile.common', __FILE__)
# Workaround for vagrant-aws issue https://github.com/mitchellh/vagrant-aws/issues/566
class Hash
def slice(*keep_keys)
h = {}
keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
h
end unless Hash.method_defined?(:slice)
def except(*less_keys)
slice(*keys - less_keys)
end unless Hash.method_defined?(:except)
end
# Customize configuration specific settings
Vagrant.configure("2") do |config|
# Dummy box for AWS provided by vagrant-aws plugin
# See section Quickstart: https://github.com/mitchellh/vagrant-aws
config.vm.box = "aws-dummy"
#
# The single node cluster comprises one node only
#
config.vm.provider :aws do |aws, override|
# Set AWS credentials
aws.access_key_id = $my_aws_access_key_id
aws.secret_access_key = $my_aws_secret_access_key
# Set SSH keys
aws.keypair_name = $my_aws_keypair_name
override.ssh.private_key_path = $my_aws_private_key_path
# Pin the AWS region
# aws.region = "eu-central-1"
aws.region = "us-east-1"
# Pin the StorageScale_base AMI
aws.ami = $my_aws_StorageScale_base_AMI_ID
# Set instance type - default is m3.medium - we need more RAM for CES
aws.instance_type = "m3.large"
# Set user name for CentOS images
override.ssh.username = "centos"
# Tag each instance running in AWS with user name
username = "#{ENV['USERNAME'] || `whoami`}"
aws.tags = { 'Name' => "StorageScaleVagrant_#{username}" }
# Add disks for StorageScale NSDs
aws.block_device_mapping = [
{ 'DeviceName' => '/dev/xvdb', 'Ebs.VolumeSize' => 3 },
{ 'DeviceName' => '/dev/xvdc', 'Ebs.VolumeSize' => 3 },
{ 'DeviceName' => '/dev/xvdd', 'Ebs.VolumeSize' => 3 },
{ 'DeviceName' => '/dev/xvde', 'Ebs.VolumeSize' => 3 },
{ 'DeviceName' => '/dev/xvdf', 'Ebs.VolumeSize' => 3 },
{ 'DeviceName' => '/dev/xvdg', 'Ebs.VolumeSize' => 5 },
{ 'DeviceName' => '/dev/xvdh', 'Ebs.VolumeSize' => 5 },
]
end
# Set name of virtual machine used by Vagrant
config.vm.define "StorageScale_single"
# Set message to be printed after VMs are up and running
config.vm.post_up_message = $message
# Send keep-alive packets to keep ssh connections alive
config.ssh.keep_alive = true
config.winssh.keep_alive = true
# Install and configure single node Storage Scale cluster
config.vm.provision "shell",
name: "Install and configure single node Storage Scale cluster",
inline: "
/vagrant/install/script.sh #{$StorageScaleVagrant_provider} #{$StorageScale_version}
"
# Configure Storage Scale for demo purposes
config.vm.provision "shell",
name: "Configure Storage Scale for demo purposes",
inline: "
/vagrant/demo/script.sh #{$StorageScaleVagrant_provider}
"
end