Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
teaching
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ardhi Putra Pratama
teaching
Commits
1d7138b3
Commit
1d7138b3
authored
7 years ago
by
Ardhi Putra Pratama
Browse files
Options
Downloads
Patches
Plain Diff
Add extra stuff on cluster management
parent
fa513508
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/Vagrantfile
+76
-0
76 additions, 0 deletions
misc/Vagrantfile
misc/cluster_adduser-key.sh
+30
-0
30 additions, 0 deletions
misc/cluster_adduser-key.sh
with
106 additions
and
0 deletions
misc/Vagrantfile
0 → 100644
+
76
−
0
View file @
1d7138b3
require
'fileutils'
Vagrant
.
require_version
">= 1.6.0"
# Defaults for config options defined in CONFIG
$num_instances
=
3
$instance_name_prefix
=
"cl-ardhi"
$enable_serial_logging
=
false
$share_home
=
true
$vm_gui
=
false
$vm_memory
=
3072
$vm_cpus
=
2
$forwarded_ports
=
{}
# 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
def
vm_gui
$vb_gui
.
nil?
?
$vm_gui
:
$vb_gui
end
def
vm_memory
$vb_memory
.
nil?
?
$vm_memory
:
$vb_memory
end
def
vm_cpus
$vb_cpus
.
nil?
?
$vm_cpus
:
$vb_cpus
end
Vagrant
.
configure
(
"2"
)
do
|
config
|
# always use Vagrants insecure key
config
.
ssh
.
insert_key
=
false
config
.
vm
.
box
=
"ubuntu/xenial64"
# enable hostmanager
config
.
hostmanager
.
enabled
=
true
# configure the host's /etc/hosts
config
.
hostmanager
.
manage_host
=
true
(
1
..
$num_instances
).
each
do
|
i
|
config
.
vm
.
define
vm_name
=
"%s-%02d"
%
[
$instance_name_prefix
,
i
]
do
|
config
|
config
.
vm
.
hostname
=
vm_name
if
$enable_serial_logging
logdir
=
File
.
join
(
File
.
dirname
(
__FILE__
),
"log"
)
FileUtils
.
mkdir_p
(
logdir
)
serialFile
=
File
.
join
(
logdir
,
"%s-serial.txt"
%
vm_name
)
FileUtils
.
touch
(
serialFile
)
config
.
vm
.
provider
:virtualbox
do
|
vb
,
override
|
vb
.
customize
[
"modifyvm"
,
:id
,
"--uart1"
,
"0x3F8"
,
"4"
]
vb
.
customize
[
"modifyvm"
,
:id
,
"--uartmode1"
,
serialFile
]
end
end
$forwarded_ports
.
each
do
|
guest
,
host
|
config
.
vm
.
network
"forwarded_port"
,
guest:
guest
,
host:
host
,
auto_correct:
true
end
config
.
vm
.
provider
:virtualbox
do
|
vb
|
vb
.
gui
=
vm_gui
vb
.
memory
=
vm_memory
vb
.
cpus
=
vm_cpus
end
ip
=
"172.17.10.
#{
i
+
100
}
"
config
.
vm
.
network
:private_network
,
ip:
ip
end
end
end
This diff is collapsed.
Click to expand it.
misc/cluster_adduser-key.sh
0 → 100755
+
30
−
0
View file @
1d7138b3
#!/bin/bash
username
=
$1
password
=
$2
p_headnode
=
"PASSWORD HEAD"
u_headnode
=
"USERNAME HEAD"
hosts
=(
cluster01 cluster03 cluster04 cluster05 cluster06
)
# end of configuration
pass
=
$(
perl
-e
'print crypt($ARGV[0], "password")'
$password
)
mkdir
/var/mirror/user/
$username
for
hostname
in
${
hosts
[@]
}
do
ssh
-t
$u_headnode
@
$hostname
"echo
$p_headnode
| sudo -S useradd -m -p
$pass
-s /bin/bash
$username
;"
sshpass
-p
"
$password
"
ssh
-o
StrictHostKeyChecking
=
no
-t
$username
@
$hostname
"ssh-keygen -f /home/
$username
/.ssh/id_rsa -t rsa -N '';"
done
for
mehost
in
${
hosts
[@]
}
do
for
hostname
in
${
hosts
[@]
}
do
sshpass
-p
"
$password
"
ssh
-t
-o
"StrictHostKeyChecking no"
$username
@
$mehost
"sshpass -p
$password
ssh-copy-id -o 'StrictHostKeyChecking no'
$username
@
$hostname
"
done
done
echo
$p_headnode
|
sudo
-S
chown
-R
$username
:
$username
/var/mirror/user/
$username
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment