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
f3eba0cd
Commit
f3eba0cd
authored
8 years ago
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed all special treatment of tags - all must now be dicts.
Convert tags parameter from list to dict in launch_ec2.
parent
cc54c890
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
15 deletions
+3
-15
playbooks/library/ec2_lookup
+2
-14
playbooks/roles/launch_ec2/tasks/main.yml
+1
-1
No files found.
playbooks/library/ec2_lookup
View file @
f3eba0cd
...
@@ -96,22 +96,10 @@ def main():
...
@@ -96,22 +96,10 @@ def main():
aws_secret_key
=
dict
(
aliases
=
[
'ec2_secret_key'
,
'secret_key'
],
aws_secret_key
=
dict
(
aliases
=
[
'ec2_secret_key'
,
'secret_key'
],
no_log
=
True
),
no_log
=
True
),
aws_access_key
=
dict
(
aliases
=
[
'ec2_access_key'
,
'access_key'
]),
aws_access_key
=
dict
(
aliases
=
[
'ec2_access_key'
,
'access_key'
]),
tags
=
dict
(
default
=
None
),
tags
=
dict
(
default
=
None
,
type
=
'dict'
),
)
)
)
)
tags_param
=
module
.
params
.
get
(
'tags'
)
tags
=
{}
if
isinstance
(
tags_param
,
list
):
for
item
in
module
.
params
.
get
(
'tags'
):
for
k
,
v
in
item
.
iteritems
():
tags
[
k
]
=
v
elif
isinstance
(
tags_param
,
dict
):
tags
=
tags_param
else
:
module
.
fail_json
(
msg
=
"Invalid format for tags"
)
aws_secret_key
=
module
.
params
.
get
(
'aws_secret_key'
)
aws_secret_key
=
module
.
params
.
get
(
'aws_secret_key'
)
aws_access_key
=
module
.
params
.
get
(
'aws_access_key'
)
aws_access_key
=
module
.
params
.
get
(
'aws_access_key'
)
region
=
module
.
params
.
get
(
'region'
)
region
=
module
.
params
.
get
(
'region'
)
...
@@ -137,7 +125,7 @@ def main():
...
@@ -137,7 +125,7 @@ def main():
instances
=
[]
instances
=
[]
instance_ids
=
[]
instance_ids
=
[]
for
res
in
ec2
.
get_all_instances
(
filters
=
{
'tag:'
+
tag
:
value
for
res
in
ec2
.
get_all_instances
(
filters
=
{
'tag:'
+
tag
:
value
for
tag
,
value
in
tags
.
iteritems
()}):
for
tag
,
value
in
module
.
params
.
get
(
'tags'
)
.
iteritems
()}):
for
inst
in
res
.
instances
:
for
inst
in
res
.
instances
:
if
inst
.
state
==
"running"
:
if
inst
.
state
==
"running"
:
instances
.
append
({
k
:
v
for
k
,
v
in
inst
.
__dict__
.
iteritems
()
instances
.
append
({
k
:
v
for
k
,
v
in
inst
.
__dict__
.
iteritems
()
...
...
This diff is collapsed.
Click to expand it.
playbooks/roles/launch_ec2/tasks/main.yml
View file @
f3eba0cd
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
module
:
ec2_lookup
module
:
ec2_lookup
region
:
"
{{
region
}}"
region
:
"
{{
region
}}"
tags
:
tags
:
-
Name
:
"
{{
name_tag
}}"
Name
:
"
{{
name_tag
}}"
register
:
tag_lookup
register
:
tag_lookup
when
:
terminate_instance ==
true
when
:
terminate_instance ==
true
...
...
This diff is collapsed.
Click to expand it.
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