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
OpenEdx
configuration
Commits
fd6ccfbd
Commit
fd6ccfbd
authored
May 03, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
naming fixes
parent
2bc8c027
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
playbooks/library/ec2_elb
+10
-7
No files found.
playbooks/library/ec2_elb
View file @
fd6ccfbd
...
...
@@ -21,8 +21,8 @@ short_description: De-registers or registers instances from EC2 ELB(s)
description:
- This module de-registers or registers an AWS EC2 instance from the ELB(s)
that it belongs to.
- Returns fact "e
lb_ec2" which is a list of elbs attached
the instance
if
deregister is called
.
- Returns fact "e
c2_elbs" which is a list of elbs attached to
the instance
if
state=absent is passed as an argument
.
- Will be marked changed when called only if there are ELBs found to operate on.
version_added: "1.2"
requirements: [ "boto" ]
...
...
@@ -40,7 +40,7 @@ options:
ec2_elbs:
description:
- List of ELB names, required for registration. The e
lb_ec2
fact should be used if there was a previous de-register.
- List of ELB names, required for registration. The e
c2_elbs
fact should be used if there was a previous de-register.
required: false
default: None
ec2_secret_key:
...
...
@@ -134,7 +134,10 @@ class ElbManager:
time
.
sleep
(
1
)
def
_get_instance_lbs
(
self
,
ec2_elbs
=
None
):
"""Returns a list of ELBs attached to self.instance_id"""
"""Returns a list of ELBs attached to self.instance_id
ec2_elbs: an optional list of elb names that will be used
for elb lookup instead of returning what elbs
are attached to self.instance_id"""
try
:
elb
=
boto
.
connect_elb
(
self
.
ec2_access_key
,
self
.
ec2_secret_key
)
...
...
@@ -170,7 +173,7 @@ def main():
ec2_access_key
=
module
.
params
[
'ec2_access_key'
]
ec2_elbs
=
module
.
params
[
'ec2_elbs'
]
if
module
.
params
[
'state'
]
==
'
register
'
and
'ec2_elbs'
not
in
module
.
params
:
if
module
.
params
[
'state'
]
==
'
present
'
and
'ec2_elbs'
not
in
module
.
params
:
module
.
fail_json
(
msg
=
"ELBs are required for registration"
)
if
not
ec2_secret_key
and
'EC2_SECRET_KEY'
in
os
.
environ
:
...
...
@@ -182,9 +185,9 @@ def main():
elb_man
=
ElbManager
(
module
,
instance_id
,
ec2_elbs
,
ec2_access_key
,
ec2_secret_key
)
if
module
.
params
[
'state'
]
==
'
register
'
:
if
module
.
params
[
'state'
]
==
'
present
'
:
elb_man
.
register
()
elif
module
.
params
[
'state'
]
==
'
deregister
'
:
elif
module
.
params
[
'state'
]
==
'
absent
'
:
elb_man
.
deregister
()
ansible_facts
=
{
'ec2_elbs'
:
[
lb
.
name
for
lb
in
elb_man
.
lbs
]}
...
...
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