diff --git a/cloud/s3 b/cloud/s3 index 480f4b1b838..fcacaadeb25 100644 --- a/cloud/s3 +++ b/cloud/s3 @@ -272,9 +272,9 @@ def main(): mode = module.params.get('mode') expiry = int(module.params['expiry']) s3_url = module.params.get('s3_url') - aws_secret_key = module.params.get('aws_secret_key') - aws_access_key = module.params.get('aws_access_key') overwrite = module.params.get('overwrite') + + ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module) if module.params.get('object'): obj = os.path.expanduser(module.params['object']) @@ -283,18 +283,6 @@ def main(): if not s3_url and 'S3_URL' in os.environ: s3_url = os.environ['S3_URL'] - if not aws_secret_key: - if 'AWS_SECRET_KEY' in os.environ: - aws_secret_key = os.environ['AWS_SECRET_KEY'] - elif 'EC2_SECRET_KEY' in os.environ: - aws_secret_key = os.environ['EC2_SECRET_KEY'] - - if not aws_access_key: - if 'AWS_ACCESS_KEY' in os.environ: - aws_access_key = os.environ['AWS_ACCESS_KEY'] - elif 'EC2_ACCESS_KEY' in os.environ: - aws_access_key = os.environ['EC2_ACCESS_KEY'] - # If we have an S3_URL env var set, this is likely to be Walrus, so change connection method if is_walrus(s3_url): try: @@ -463,8 +451,8 @@ def main(): module.exit_json(failed=False) - -# this is magic, see lib/ansible/module_common.py -#<> +# import module snippets +from ansible.module_utils.basic import * +from ansible.module_utils.ec2 import * main()