summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/ec2.py
diff options
context:
space:
mode:
authorWill Thames <will@thames.id.au>2014-02-05 21:11:06 +1000
committerwillthames <will@thames.id.au>2014-02-06 15:27:41 +1000
commit7600c664fe40123bbd2ea1eab12c927e9b519228 (patch)
treeebdd0558c78bc48b3dc5604b68b79da96adea566 /lib/ansible/module_utils/ec2.py
parentdbeddd3e14765f70da6e5a69092948e4bcd2143e (diff)
downloadansible-7600c664fe40123bbd2ea1eab12c927e9b519228.tar.gz
Create a common EC2 connection argument spec for EC2 modules
Refactor the currently well-factored ec2 modules (i.e. those that already use ec2_connect) to have a common argument spec. The idea is that new modules can use this spec without duplication of code, and that new functionality can be added to the ec2 connection code (e.g. security token argument)
Diffstat (limited to 'lib/ansible/module_utils/ec2.py')
-rw-r--r--lib/ansible/module_utils/ec2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py
index 4e8fa11f0f..bbcd30be21 100644
--- a/lib/ansible/module_utils/ec2.py
+++ b/lib/ansible/module_utils/ec2.py
@@ -8,6 +8,15 @@ AWS_REGIONS = ['ap-northeast-1',
'us-west-2']
+def ec2_argument_spec():
+ return dict(
+ region=dict(aliases=['aws_region', 'ec2_region'], choices=AWS_REGIONS),
+ ec2_url=dict(),
+ ec2_secret_key=dict(aliases=['aws_secret_key', 'secret_key'], no_log=True),
+ ec2_access_key=dict(aliases=['aws_access_key', 'access_key']),
+ )
+
+
def get_ec2_creds(module):
# Check module args for credentials, then check environment vars