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
e4146b31
Commit
e4146b31
authored
May 02, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the previous module ec2_elb_facts is made obsolete by ec2_elb
parent
509abf4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
71 deletions
+0
-71
playbooks/library/ec2_elb_facts
+0
-71
No files found.
playbooks/library/ec2_elb_facts
deleted
100644 → 0
View file @
509abf4e
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION
=
"""
---
module: ec2_elb_facts
short_description: Creates a fact with instance to ELB mappings
version_added: "1.0"
options: {}
description:
- This module fetches data from AWS using the boto api and returns
a hash as a fact that maps instances to the ELB(s) that they belong to.
examples:
- code: ansible all -m ec2_elb_facts
description: Obtain ELB info using boto
requirements: [ "boto" ]
author: "John Jarvis <john@jarv.org>"
"""
try
:
import
boto
except
ImportError
:
print
"failed=True msg='boto required for this module'"
sys
.
exit
(
1
)
from
collections
import
defaultdict
def
get_elb_info
(
module
):
try
:
elb
=
boto
.
connect_elb
()
except
boto
.
exception
.
NoAuthHandlerFound
,
e
:
module
.
fail_json
(
msg
=
str
(
e
))
elbs
=
elb
.
get_all_load_balancers
()
elb_info
=
defaultdict
(
set
)
for
lb
in
elbs
:
for
info
in
lb
.
instances
:
elb_info
[
info
.
id
]
.
add
(
lb
.
name
)
elb_info
=
{
k
:
list
(
v
)
for
k
,
v
in
elb_info
.
iteritems
()}
return
elb_info
def
main
():
module
=
AnsibleModule
(
argument_spec
=
dict
())
elb_info
=
get_elb_info
(
module
)
ec2_facts_result
=
dict
(
changed
=
False
,
ansible_facts
=
{
'elbs'
:
elb_info
})
module
.
exit_json
(
**
ec2_facts_result
)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main
()
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