Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ardhi Putra Pratama
teaching
Commits
5dc6b169
Commit
5dc6b169
authored
Feb 21, 2018
by
Ardhi Putra Pratama
Browse files
Add provision script
parent
1d7138b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
misc/Vagrantfile
View file @
5dc6b169
...
...
@@ -4,7 +4,7 @@ Vagrant.require_version ">= 1.6.0"
# Defaults for config options defined in CONFIG
$num_instances
=
3
$instance_name_prefix
=
"c
l
-ardhi"
$instance_name_prefix
=
"
hp
c-ardhi"
$enable_serial_logging
=
false
$share_home
=
true
$vm_gui
=
false
...
...
@@ -12,12 +12,28 @@ $vm_memory = 3072
$vm_cpus
=
2
$forwarded_ports
=
{}
$prov
=
<<
SCRIPT
apt update
apt -y install sshpass build-essential libopenmpi-dev openmpi-bin openmpi-doc
sed -i 's/^PasswordAuthentication .*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
systemctl restart sshd.service
SCRIPT
$prov_local
=
<<
SCRIPT
touch me-$1.txt
touch total-$2.txt
echo -e 'n
\n
' | ssh-keygen -f .ssh/id_rsa -t rsa -N ''
SCRIPT
# Attempt to apply the deprecated environment variable NUM_INSTANCES to
# $num_instances while allowing config.rb to override it
if
ENV
[
"NUM_INSTANCES"
].
to_i
>
0
&&
ENV
[
"NUM_INSTANCES"
]
$num_instances
=
ENV
[
"NUM_INSTANCES"
].
to_i
end
# Use old vb_xxx config variables when set
def
vm_gui
$vb_gui
.
nil?
?
$vm_gui
:
$vb_gui
end
...
...
@@ -39,6 +55,7 @@ Vagrant.configure("2") do |config|
# enable hostmanager
config
.
hostmanager
.
enabled
=
true
# configure the host's /etc/hosts
config
.
hostmanager
.
manage_host
=
true
...
...
@@ -63,6 +80,9 @@ Vagrant.configure("2") do |config|
config
.
vm
.
network
"forwarded_port"
,
guest:
guest
,
host:
host
,
auto_correct:
true
end
# shared folder
config
.
vm
.
synced_folder
"vhome/"
,
"/vhome"
config
.
vm
.
provider
:virtualbox
do
|
vb
|
vb
.
gui
=
vm_gui
vb
.
memory
=
vm_memory
...
...
@@ -71,6 +91,10 @@ Vagrant.configure("2") do |config|
ip
=
"172.17.10.
#{
i
+
100
}
"
config
.
vm
.
network
:private_network
,
ip:
ip
config
.
vm
.
provision
:"shell"
,
inline:
$prov
config
.
vm
.
provision
:"shell"
,
inline:
$prov_local
,
args
:"
#{
i
}
#{
$num_instances
}
"
,
privileged:
false
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment