From c679491ece82fd727a1ac132ffb69645dceb0126 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Wed, 9 Oct 2013 12:56:56 -0400 Subject: [PATCH] #4408 s3: add force alias for overwrite and set True by default --- library/cloud/s3 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/library/cloud/s3 b/library/cloud/s3 index e67bc079d1..ae74424a57 100644 --- a/library/cloud/s3 +++ b/library/cloud/s3 @@ -52,7 +52,7 @@ options: description: - Force overwrite either locally on the filesystem or remotely with the object/key. Used with PUT and GET operations. required: false - default: false + default: true version_added: "1.2" mode: description: @@ -93,9 +93,13 @@ EXAMPLES = ''' # Simple GET operation - s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get # GET/download and overwrite local file (trust remote) -- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get overwrite=true +- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get +# GET/download and do not overwrite local file (trust remote) +- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get force=false # PUT/upload and overwrite remote file (trust local) -- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put overwrite=true +- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put +# PUT/upload and do not overwrite remote file (trust local) +- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put force=false # Download an object as a string to use else where in your playbook - s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=getstr # Create an empty bucket @@ -253,7 +257,7 @@ def main(): s3_url = dict(aliases=['S3_URL']), aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True, required=False), aws_access_key = dict(aliases=['ec2_access_key', 'access_key'], required=False), - overwrite = dict(default=False, type='bool'), + overwrite = dict(aliases=['force'], default=True, type='bool'), ), )