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
bb122c34
Commit
bb122c34
authored
Aug 03, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3747 from lorin/ec2-check
ec2: check for changes
parents
b31cef48
3647d112
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
library/cloud/ec2
+7
-6
No files found.
library/cloud/ec2
View file @
bb122c34
...
...
@@ -396,7 +396,10 @@ def create_instances(module, ec2):
# Both min_count and max_count equal count parameter. This means the launch request is explicit (we want count, or fail) in how many instances we want.
if
count_remaining
>
0
:
if
count_remaining
==
0
:
changed
=
False
else
:
changed
=
True
try
:
params
=
{
'image_id'
:
image
,
'key_name'
:
key_name
,
...
...
@@ -465,7 +468,7 @@ def create_instances(module, ec2):
created_instance_ids
.
append
(
inst
.
id
)
instance_dict_array
.
append
(
d
)
return
(
instance_dict_array
,
created_instance_ids
)
return
(
instance_dict_array
,
created_instance_ids
,
changed
)
def
terminate_instances
(
module
,
ec2
,
instance_ids
):
...
...
@@ -542,7 +545,6 @@ def main():
ec2_secret_key
=
module
.
params
.
get
(
'ec2_secret_key'
)
ec2_access_key
=
module
.
params
.
get
(
'ec2_access_key'
)
region
=
module
.
params
.
get
(
'region'
)
termination_list
=
module
.
params
.
get
(
'termination_list'
)
# allow eucarc environment variables to be used if ansible vars aren't set
...
...
@@ -578,14 +580,13 @@ def main():
elif
module
.
params
.
get
(
'state'
)
==
'present'
:
# Changed is always set to true when provisioning new instances
changed
=
True
if
not
module
.
params
.
get
(
'key_name'
):
module
.
fail_json
(
msg
=
'key_name parameter is required for new instance'
)
if
not
module
.
params
.
get
(
'image'
):
module
.
fail_json
(
msg
=
'image parameter is required for new instance'
)
(
instance_dict_array
,
new_instance_ids
)
=
create_instances
(
module
,
ec2
)
(
instance_dict_array
,
new_instance_ids
,
changed
)
=
create_instances
(
module
,
ec2
)
module
.
exit_json
(
changed
=
True
,
instance_ids
=
new_instance_ids
,
instances
=
instance_dict_array
)
module
.
exit_json
(
changed
=
changed
,
instance_ids
=
new_instance_ids
,
instances
=
instance_dict_array
)
# this is magic, see lib/ansible/module_common.py
...
...
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