Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
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
ansible
Commits
2b84a40d
Commit
2b84a40d
authored
Mar 11, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming reuse parameter in ec2_eip and adding a version_added string
parent
89c091d6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
library/cloud/ec2_eip
+8
-7
No files found.
library/cloud/ec2_eip
View file @
2b84a40d
...
@@ -75,11 +75,12 @@ options:
...
@@ -75,11 +75,12 @@ options:
default: null
default: null
aliases: []
aliases: []
version_added: "1.6"
version_added: "1.6"
reuse:
reuse
_existing_ip_allowed
:
description:
description:
- Reuse an EIP that is not associated to an instance (when available), instead of allocating a new one.
- Reuse an EIP that is not associated to an instance (when available), instead of allocating a new one.
required: false
required: false
default: false
default: false
version_added: "1.6"
requirements: [ "boto" ]
requirements: [ "boto" ]
author: Lorin Hochstein <lorin@nimbisservices.com>
author: Lorin Hochstein <lorin@nimbisservices.com>
...
@@ -194,13 +195,13 @@ def ip_is_associated_with_instance(ec2, public_ip, instance_id, module):
...
@@ -194,13 +195,13 @@ def ip_is_associated_with_instance(ec2, public_ip, instance_id, module):
return
False
return
False
def
allocate_address
(
ec2
,
domain
,
module
,
reuse
):
def
allocate_address
(
ec2
,
domain
,
module
,
reuse
_existing_ip_allowed
):
""" Allocate a new elastic IP address (when needed) and return it """
""" Allocate a new elastic IP address (when needed) and return it """
# If we're in check mode, nothing else to do
# If we're in check mode, nothing else to do
if
module
.
check_mode
:
if
module
.
check_mode
:
module
.
exit_json
(
change
=
True
)
module
.
exit_json
(
change
=
True
)
if
reuse
:
if
reuse
_existing_ip_allowed
:
if
domain
:
if
domain
:
domain_filter
=
{
'domain'
:
domain
}
domain_filter
=
{
'domain'
:
domain
}
else
:
else
:
...
@@ -258,7 +259,7 @@ def main():
...
@@ -258,7 +259,7 @@ def main():
state
=
dict
(
required
=
False
,
default
=
'present'
,
state
=
dict
(
required
=
False
,
default
=
'present'
,
choices
=
[
'present'
,
'absent'
]),
choices
=
[
'present'
,
'absent'
]),
in_vpc
=
dict
(
required
=
False
,
choices
=
BOOLEANS
,
default
=
False
),
in_vpc
=
dict
(
required
=
False
,
choices
=
BOOLEANS
,
default
=
False
),
reuse
=
dict
(
required
=
False
,
choices
=
BOOLEANS
,
default
=
False
),
reuse
_existing_ip_allowed
=
dict
(
required
=
False
,
type
=
'bool'
,
default
=
False
),
)
)
)
)
...
@@ -277,19 +278,19 @@ def main():
...
@@ -277,19 +278,19 @@ def main():
state
=
module
.
params
.
get
(
'state'
)
state
=
module
.
params
.
get
(
'state'
)
in_vpc
=
module
.
params
.
get
(
'in_vpc'
)
in_vpc
=
module
.
params
.
get
(
'in_vpc'
)
domain
=
"vpc"
if
in_vpc
else
None
domain
=
"vpc"
if
in_vpc
else
None
reuse
=
module
.
params
.
get
(
'reuse
'
);
reuse
_existing_ip_allowed
=
module
.
params
.
get
(
'reuse_existing_ip_allowed
'
);
if
state
==
'present'
:
if
state
==
'present'
:
if
public_ip
is
None
:
if
public_ip
is
None
:
if
instance_id
is
None
:
if
instance_id
is
None
:
address
=
allocate_address
(
ec2
,
domain
,
module
,
reuse
)
address
=
allocate_address
(
ec2
,
domain
,
module
,
reuse
_existing_ip_allowed
)
module
.
exit_json
(
changed
=
True
,
public_ip
=
address
.
public_ip
)
module
.
exit_json
(
changed
=
True
,
public_ip
=
address
.
public_ip
)
else
:
else
:
# Determine if the instance is inside a VPC or not
# Determine if the instance is inside a VPC or not
instance
=
find_instance
(
ec2
,
instance_id
,
module
)
instance
=
find_instance
(
ec2
,
instance_id
,
module
)
if
instance
.
vpc_id
!=
None
:
if
instance
.
vpc_id
!=
None
:
domain
=
"vpc"
domain
=
"vpc"
address
=
allocate_address
(
ec2
,
domain
,
module
,
reuse
)
address
=
allocate_address
(
ec2
,
domain
,
module
,
reuse
_existing_ip_allowed
)
else
:
else
:
address
=
find_address
(
ec2
,
public_ip
,
module
)
address
=
find_address
(
ec2
,
public_ip
,
module
)
associate_ip_and_instance
(
ec2
,
address
,
instance_id
,
module
)
associate_ip_and_instance
(
ec2
,
address
,
instance_id
,
module
)
...
...
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