I was looking at the documentation for the s3 (aws_s3 in ansible 2.4 and above) module and noticed that there is a getstr mode that downloads an S3 object as a string.
I’ve been playing around with this and the only way I can figure out how to use that string is to register a variable to store the output of the s3 task that downloads
the string and then referencing it with string.contents. Am I missing something here or is there another way to do this?
- name: Download the contents of an S3 object as a string
s3:
ec2_url: “{{ s3_endpoint }}”
bucket: “{{ s3_bucket }}”
object: "{{ s3_object }}
mode: getstr
aws_access_key: “{{ s3_access_key_id }}”
aws_secret_key: “{{ s3_secret_access_key }}”
register: s3_string