Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ansible
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
36
Issues
36
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
las-it-organisation
32-0-IT instructions and rules
ansible
Commits
de1f88fa
Commit
de1f88fa
authored
Feb 05, 2018
by
julian.gethmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pelegant_setup.sh script working
parent
5e04c99c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
roles/elegant/files/pelegant_setup.sh
roles/elegant/files/pelegant_setup.sh
+29
-12
No files found.
roles/elegant/files/pelegant_setup.sh
View file @
de1f88fa
#!/bin/bash
# bash >= 4 required
# This script assumes to be run only once per day and overwrites files
# It also
does
shouldn't be run for different hosts in parallel
# It also shouldn't be run for different hosts in parallel
# Search the "Edit"-line
#
# - This script has not been tested so far
...
...
@@ -11,22 +11,39 @@ IFS=$'\n\t'
############################################################
# Edit:
declare
-A
host
s_cpus
=(
[
"las113"
]=
"6"
[
"las126"
]=
"11
"
)
declare
-A
host
_cpus
=(
[
"129.13.108.79"
]=
"3"
[
"129.13.108.113"
]=
"6
"
)
############################################################
filename
=
"~/.ssh/Pelegant_
$(
date
--iso
)
"
ssh-keygen
-f
"
${
filename
}
"
-q
# main_host=$(hostname -f)
main_host
=
$(
ip
-br
-4
addr|
\
grep
'129.13.108.'
|
\
awk
'{print $3}'
|
\
cut
-d
"/"
-f1
)
printf
"Generating SSH keys
\n
"
filename
=
~/.ssh/
"id_Pelegant_
$(
date
--iso
)
"
ssh-keygen
-q
-t
ed25519
-o
-f
"
${
filename
}
"
-C
"Pelegant run from
${
main_host
}
at
$(
date
)
"
printf
"Creating mpihosts file
\n
"
if
[
-f
~/.mpihosts
]
;
then
mv
~/.mpihosts ~/.mpihosts.
${
date
--iso
}
/usr/bin/mv ~/.mpihosts ~/.mpihosts.
$(
date
--iso
)
fi
for
cpus
in
"
${
!host_cpus[@]
}
"
;
do
echo
"
${
host_cpus
[
$cpus
]
}
"
:
${
cpus
}
user
=
${
USER
}
>>
~/.mpihosts
for
host
in
"
${
!host_cpus[@]
}
"
;
do
/usr/bin/echo
"
${
host
}
:
${
host_cpus
[
$host
]
}
"
user
=
${
USER
}
>>
~/.mpihosts
done
for
cpus
in
"
${
!host_cpus[@]
}
"
;
do
dest
=
"
${
host_cpus
[
$cpus
]
}
"
ssh-copy-id
-i
"
${
filename
}
"
${
dest
}
scp
"
${
filename
}
"
"
${
dest
}
:~/.ssh/"
scp
"
${
mpifile
}
"
"
${
dest
}
:.mpihosts"
printf
"Copying files and mounting SSHFS
\n
"
for
host
in
"
${
!host_cpus[@]
}
"
;
do
cpu
=
"
${
host_cpus
[
$host
]
}
"
printf
"SSH copy from %s to %s (%s)"
,
${
main_host
}
,
${
host
}
,
${
filename
}
scp
"
${
filename
}
"
"
${
host
}
:~/.ssh/"
scp
"
${
filename
}
.pub"
"
${
host
}
:~/.ssh/"
ssh-copy-id
-i
"
${
filename
}
"
${
host
}
ssh-copy-id
-i
"
${
filename
}
"
${
main_host
}
scp ~/.mpihosts
"
${
host
}
:.mpihosts"
curdir
=
${
PWD
}
ssh
-i
"
${
filename
}
"
${
host
}
"ssh-copy-id -i
${
filename
}
${
main_host
}
"
ssh
-i
"
${
filename
}
"
${
host
}
"mkdir
${
curdir
}
&& sshfs
${
main_host
}
:
${
curdir
}
${
curdir
}
-o IdentityFile=
\"
${
filename
}
\"
"
done
Write
Preview
Markdown
is supported
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