Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fabien Bosquet
infra-azure-provisioning
Commits
5791fa23
Commit
5791fa23
authored
Oct 14, 2020
by
Daniel Scholl
Browse files
Fixed error on installing flux
parent
2c1675b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
infra/templates/osdu-r3-mvp/common_prepare.sh
View file @
5791fa23
...
@@ -219,7 +219,7 @@ function CreateADApplication() {
...
@@ -219,7 +219,7 @@ function CreateADApplication() {
tput setaf 3
;
echo
"AD Application
$1
already exists."
;
tput sgr0
tput setaf 3
;
echo
"AD Application
$1
already exists."
;
tput sgr0
fi
fi
}
}
function
CreateSSHKeys
()
{
function
CreateSSHKeys
Passphrase
()
{
# Required Argument $1 = SSH_USER
# Required Argument $1 = SSH_USER
# Required Argument $2 = KEY_NAME
# Required Argument $2 = KEY_NAME
...
@@ -247,11 +247,13 @@ function CreateSSHKeys() {
...
@@ -247,11 +247,13 @@ function CreateSSHKeys() {
tput setaf 3
;
echo
"SSH Keys already exist."
;
tput sgr0
tput setaf 3
;
echo
"SSH Keys already exist."
;
tput sgr0
PASSPHRASE
=
`
cat
~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.passphrase
`
PASSPHRASE
=
`
cat
~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.passphrase
`
else
else
BASE_DIR
=
$(
pwd
)
cd
~/.ssh/osdu_
${
UNIQUE
}
cd
~/.ssh/osdu_
${
UNIQUE
}
PASSPHRASE
=
$(
echo
$((
RANDOM%20000000000000000000+100000000000000000000
))
)
PASSPHRASE
=
$(
echo
$((
RANDOM%20000000000000000000+100000000000000000000
))
)
echo
"
$PASSPHRASE
"
>>
"
$2
.passphrase"
echo
"
$PASSPHRASE
"
>>
"
$2
.passphrase"
ssh-keygen
-t
rsa
-b
2048
-C
$1
-f
$2
-N
$PASSPHRASE
&&
cd
..
ssh-keygen
-t
rsa
-b
2048
-C
$1
-f
$2
-N
$PASSPHRASE
cd
$BASE_DIR
fi
fi
AddKeyToVault
$AZURE_VAULT
"
${
2
}
"
"~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
"
"file"
AddKeyToVault
$AZURE_VAULT
"
${
2
}
"
"~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
"
"file"
...
@@ -261,6 +263,46 @@ function CreateSSHKeys() {
...
@@ -261,6 +263,46 @@ function CreateSSHKeys() {
_result
=
`
cat
~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.pub
`
_result
=
`
cat
~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.pub
`
echo
$_result
echo
$_result
}
}
function
CreateSSHKeys
()
{
# Required Argument $1 = SSH_USER
# Required Argument $2 = KEY_NAME
if
[
-z
$1
]
;
then
tput setaf 1
;
echo
'ERROR: Argument $1 (SSH_USER) not received'
;
tput sgr0
exit
1
;
fi
if
[
-z
$2
]
;
then
tput setaf 1
;
echo
'ERROR: Argument $2 (KEY_NAME) not received'
;
tput sgr0
exit
1
;
fi
if
[
!
-d
~/.ssh
]
then
mkdir
~/.ssh
fi
if
[
!
-d
~/.ssh/osdu_
${
UNIQUE
}
]
then
mkdir
~/.ssh/osdu_
${
UNIQUE
}
fi
if
[
-f
~/.ssh/osdu_
${
UNIQUE
}
/
$2
.pub
]
;
then
tput setaf 3
;
echo
"SSH Keys already exist."
;
tput sgr0
else
BASE_DIR
=
$(
pwd
)
cd
~/.ssh/osdu_
${
UNIQUE
}
ssh-keygen
-t
rsa
-b
2048
-C
$1
-f
$2
-N
""
cd
$BASE_DIR
fi
AddKeyToVault
$AZURE_VAULT
"
${
2
}
"
"~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
"
"file"
AddKeyToVault
$AZURE_VAULT
"
${
2
}
-pub"
"~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.pub"
"file"
_result
=
`
cat
~/.ssh/osdu_
${
UNIQUE
}
/
${
2
}
.pub
`
echo
$_result
}
function
CreateKeyVault
()
{
function
CreateKeyVault
()
{
# Required Argument $1 = KV_NAME
# Required Argument $1 = KV_NAME
...
@@ -480,11 +522,8 @@ CreateADApplication "osdu-mvp-${UNIQUE}-application" $AZURE_VAULT
...
@@ -480,11 +522,8 @@ CreateADApplication "osdu-mvp-${UNIQUE}-application" $AZURE_VAULT
CreateADApplication
"osdu-mvp-
${
UNIQUE
}
-noaccess"
$AZURE_VAULT
CreateADApplication
"osdu-mvp-
${
UNIQUE
}
-noaccess"
$AZURE_VAULT
tput setaf 2
;
echo
'Creating SSH Keys...'
;
tput sgr0
tput setaf 2
;
echo
'Creating SSH Keys...'
;
tput sgr0
GITOPS_KEY
=
"azure-aks-gitops-ssh-key"
CreateSSHKeys
$AZURE_AKS_USER
"azure-aks-gitops-ssh-key"
CreateSSHKeys
$AZURE_AKS_USER
$GITOPS_KEY
CreateSSHKeysPassphrase
$AZURE_AKS_USER
"azure-aks-node-ssh-key"
AddKeyToVault
$AZURE_VAULT
"azure-aks-gitops-ssh-key"
"~/.ssh/osdu_
${
UNIQUE
}
/
${
GITOPS_KEY
}
"
"file"
CreateSSHKeys
$AZURE_AKS_USER
"azure-aks-node-ssh-key"
tput setaf 2
;
echo
"# OSDU ENVIRONMENT
${
UNIQUE
}
"
;
tput sgr0
tput setaf 2
;
echo
"# OSDU ENVIRONMENT
${
UNIQUE
}
"
;
tput sgr0
tput setaf 3
;
echo
"------------------------------------"
;
tput sgr0
tput setaf 3
;
echo
"------------------------------------"
;
tput sgr0
...
...
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