Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
b04fd888
Commit
b04fd888
authored
Sep 11, 2014
by
e0d
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1528 from edx/e0d/minos-fixes
refactoring
parents
f101adcf
763cb84c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
playbooks/edx-east/lifecycle_inventory.py
+15
-1
playbooks/edx-east/retire_host.yml
+7
-4
No files found.
playbooks/edx-east/lifecycle_inventory.py
View file @
b04fd888
...
...
@@ -41,6 +41,18 @@ class LifecycleInventory():
parser
=
argparse
.
ArgumentParser
()
self
.
profile
=
profile
def
get_e_d_from_tags
(
self
,
group
):
environment
=
"default_environment"
deployment
=
"default_deployment"
for
r
in
group
.
tags
:
if
r
.
key
==
"environment"
:
environment
=
r
.
value
elif
r
.
key
==
"deployment"
:
deployment
=
r
.
value
return
environment
,
deployment
def
get_instance_dict
(
self
):
ec2
=
boto
.
connect_ec2
(
profile_name
=
self
.
profile
)
reservations
=
ec2
.
get_all_instances
()
...
...
@@ -65,8 +77,10 @@ class LifecycleInventory():
private_ip_address
=
instances
[
instance
.
instance_id
]
.
private_ip_address
if
private_ip_address
:
environment
,
deployment
=
self
.
get_e_d_from_tags
(
group
)
inventory
[
environment
+
"_"
+
deployment
+
"_"
+
instance
.
lifecycle_state
.
replace
(
":"
,
"_"
)]
.
append
(
private_ip_address
)
inventory
[
group
.
name
]
.
append
(
private_ip_address
)
inventory
[
group
.
name
+
"_"
+
instance
.
lifecycle_state
]
.
append
(
private_ip_address
)
inventory
[
group
.
name
+
"_"
+
instance
.
lifecycle_state
.
replace
(
":"
,
"_"
)
]
.
append
(
private_ip_address
)
inventory
[
instance
.
lifecycle_state
.
replace
(
":"
,
"_"
)]
.
append
(
private_ip_address
)
print
json
.
dumps
(
inventory
,
sort_keys
=
True
,
indent
=
2
)
...
...
playbooks/edx-east/retire_host.yml
View file @
b04fd888
# ansible-playbook -i ./lifecycle_inventory.py ./retire_host.yml
# -e@/vars/env.yml --limit Terminating_Wait
# -e@/vars/env.yml --limit Terminating_Wait -e TARGET="Terminating_Wait"
#
# Note that the target now must be specified as an argument
#
#
# This is separate because it's use of handlers
# leads to various race conditions.
#
-
name
:
Stop all services
hosts
:
Terminating_Wait
hosts
:
"
{{TARGET}}"
sudo
:
True
gather_facts
:
False
vars
:
...
...
@@ -15,7 +18,7 @@
-
stop_all_edx_services
-
name
:
Server retirement workflow
hosts
:
Terminating_Wait
hosts
:
"
{{TARGET}}"
sudo
:
True
gather_facts
:
False
tasks
:
...
...
@@ -38,7 +41,7 @@
command
:
/edx/bin/send-logs-to-s3 -d "{{ COMMON_LOG_DIR }}/tracking/*" -b "{{ COMMON_AWS_SYNC_BUCKET }}/logs/tracking"
-
name
:
Run minos verification
hosts
:
Terminating_Wait
hosts
:
"
{{TARGET}}"
sudo
:
True
gather_facts
:
False
tasks
:
...
...
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