Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
terraform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
702
HADOOP
terraform
Commits
36473f39
Commit
36473f39
authored
Dec 22, 2020
by
František Dvořák
Browse files
Options
Downloads
Patches
Plain Diff
Poor-man implementation of waiting
parent
90e74c82
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
launch.sh
+0
-4
0 additions, 4 deletions
launch.sh
orchestrate.py
+33
-5
33 additions, 5 deletions
orchestrate.py
with
33 additions
and
9 deletions
launch.sh
+
0
−
4
View file @
36473f39
#! /bin/sh -xe
./terraform apply
-auto-approve
"
$@
"
./terraform output
-json
>
config.json
echo
'Sleeping...'
sleep
60
echo
"Press <ENTER> to continue..."
read
x
./orchestrate.py
-c
config.json
This diff is collapsed.
Click to expand it.
orchestrate.py
+
33
−
5
View file @
36473f39
...
...
@@ -6,8 +6,9 @@ import json
import
os
import
subprocess
import
sys
import
time
DEFAULT_ACTIONS
=
[
'
files
'
,
'
init
'
,
'
check
'
]
DEFAULT_ACTIONS
=
[
'
files
'
,
'
ping
'
,
'
init
'
,
'
wait
'
]
parser
=
argparse
.
ArgumentParser
(
description
=
'
terraform cluster orchestrator
'
)
parser
.
add_argument
(
'
-c
'
,
'
--config
'
,
...
...
@@ -89,6 +90,31 @@ ff02::2 ip6-allrouters
if
component
:
component
.
action
(
'
files
'
)
if
'
ping
'
in
args
.
actions
:
print
(
'
== ping ==
'
)
if
not
args
.
dry_run
:
print
(
'
-> (ping)
'
,
end
=
''
)
ret
=
None
while
ret
is
None
or
ret
!=
0
:
print
(
'
.
'
,
end
=
''
)
ret
=
subprocess
.
call
([
'
ping
'
,
'
-c
'
,
'
1
'
,
'
-i
'
,
'
2
'
,
master_ip
])
print
(
''
)
cmd
=
[
'
ssh-keygen
'
,
'
-R
'
,
master_ip
]
print
(
'
-> %s
'
%
'
'
.
join
(
cmd
))
subprocess
.
run
(
cmd
)
cmd
=
[
'
ssh
'
,
'
%s@%s
'
%
(
user
,
master_ip
),
'
-o
'
,
'
ConnectTimeout=5
'
,
'
-o
'
,
'
StrictHostKeyChecking=no
'
,
'
:
'
]
ret
=
None
while
ret
is
None
or
ret
!=
0
:
print
(
'
-> %s
'
%
'
'
.
join
(
cmd
))
ret
=
subprocess
.
call
(
cmd
)
time
.
sleep
(
2
)
print
(
''
)
print
(
'
-> sleep %d
'
%
10
+
5
*
n
)
time
.
sleep
(
10
+
5
*
n
)
if
component
:
component
.
action
(
'
ping
'
)
if
'
init
'
in
args
.
actions
:
print
(
'
== init ==
'
)
...
...
@@ -122,11 +148,13 @@ if 'init' in args.actions:
if
component
:
component
.
action
(
'
init
'
)
if
'
check
'
in
args
.
actions
:
print
(
'
==
check
==
'
)
if
'
wait
'
in
args
.
actions
:
print
(
'
==
wait
==
'
)
commands
=
[
[
'
ansible
'
,
'
-i
'
,
'
./inventory
'
,
'
-m
'
,
'
command
'
,
'
-a
'
,
'
uname -a
'
,
'
all
'
]
[
'
ansible
'
,
'
-i
'
,
'
./inventory
'
,
'
-m
'
,
'
command
'
,
'
-a
'
,
'
uname -a
'
,
'
all
'
],
[
'
ansible
'
,
'
-i
'
,
'
./inventory
'
,
'
-m
'
,
'
shell
'
,
'
-a
'
,
'
while ! test -f /var/lib/cloud/instance/boot-finished; do sleep 2; done
'
,
'
all
'
],
]
for
cmd
in
commands
:
...
...
@@ -134,4 +162,4 @@ if 'check' in args.actions:
if
not
args
.
dry_run
:
subprocess
.
run
(
cmd
)
if
component
:
component
.
action
(
'
check
'
)
component
.
action
(
'
wait
'
)
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