S3 module - attempting to create folders via dest parameter ?

Is it possible to use the S3 module to create folders within a bucket?

I am using ansible 1.1 and am getting;

msg: unsupported parameter for module: dest

The docs lead me to believe that the dest param is available to 1.1 (says nothing about being introduced in 1.2); although I can’t get it to work.
Besides that; is dest intended to create folders? My command is;

  • name: recreate bucket ( $bucket ) and add test_file ($file) to bucket/test_folder
    action: s3 bucket=$bucket state=present dest=“test_folder” path=$file ec2_access_key=$iam_s3_rw_key ec2_secret_key=$iam_s3_rw_secret

Many thanks.

~ Brice

Hi Brice,

No, the dest parameter in S3 is an override for the keyname (so the object, basically). Thus it can’t be used to create folders. Perhaps the parameter name for that one is a little misleading, or at least needs to be clearer. I’ll add an example with that parameter being used …

Lester

p.s. interested in feedback on this module. I’d like to spend some more time improving it in the near future.

lwade,

Thanks for the response; assuming that dest

I’d like to be able to create folders. Is this possible? I’ve tried passing slashes in the bucket; e.g. bucket=bucketName/folderName – and the task hangs.

Re: feedback – outside of folder creation I’ve had a fair time with the module. Perhaps if there’s a slash in dest; it will create the folder? E.g.

action: s3 bucket=$bucket state=present dest=“subdir/test_file” path=/tmp/test_file

Also; It would be great if there was standardization in naming; e.g. I’m assuming dest is similar to dest in the template + lineinfile module. As such; why not use src as the source parameter of the file to PUT to allow uploading files from the machine running ansible; and use path (as it is now) to PUT a file from the machine ansible is executing against?

There may be a case to support GET because of private buckets that are inacessible via get_url or uri modules…

Lastly it would be nice to have the documentation updated to reflect that the s3 module supports the ec2_access_key and ec2_secret_key parameters ; similar to how template & copy respect the permissions parameters of the file module.

~ Brice

It would probably be nice to adhere to the “file” -esque module conventions and use

lwade,

Does the S3 module support creating folders within a bucket?

Thanks!

~ Brice

Hey Brice,

No not currently. Sorry for the delay. Regarding your previous email …

With the parameters of the s3 module we had a fair discussion on here many months back about what form would be best, there would be some subtle differences to the file module since we’re uploading/downloading. Once I get a bit more time I’ll probably work this into a re-write.

lwade,

Roger that. I took a peek at the thread but didn’t see anything official come out of it. Good luck && let me know if you need any help! :slight_smile:

Thanks,

~ Brice