Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 2.02 KB

UPLOAD_FILE_TO_S3.md

File metadata and controls

58 lines (41 loc) · 2.02 KB

cloud.aws_ops.upload_file_to_s3

A playbook to upload a local file to S3. When running this playbook the file to upload is expected to be located on the remote host, the controller host is responsible of the PUT operation on the S3 bucket.

Variables

  • aws_access_key: The AWS access key to use. type: str

  • aws_secret_key: The AWS secret key that corresponds to the access key. type: str

  • aws_security_token: The AWS security token if using temporary access and secret keys. type: str

  • aws_profile: A named AWS profile to use for authentication. type: str

  • upload_file_to_s3_bucket_name: (Required) Name of an existing bucket to upload file in. type: str

  • upload_file_to_s3_file_path: (Required) Path to a local file to upload. type: path

  • upload_file_to_s3_object_name: Object name inside the bucket. Default to file basename. type: str

  • upload_file_to_s3_object_permission: This option lets the user set the canned permissions on the object that is created. type: str, valid values are: private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, bucket-owner-full-control

  • upload_file_to_s3_object_overwrite: Force overwrite remotely with the object/key. type: bool.

Dependencies

  • NA

Example

vars.yaml

---
aws_profile: sample-profile
upload_file_to_s3_bucket_name: my-test-bucket
upload_file_to_s3_file_path: /path/to/file/on/remote/host

playbook.yaml

---
ansible.builtin.import_playbook: cloud.aws_ops.upload_file_to_s3

inventory.ini

[all]
sample_host ansible_ssh_user=some_user ansible_host=xxx.xxx.xxx.xxx

Run the following command:

ansible-playbook ./playbook.yaml -e "@./vars.yaml" -i inventory.ini

License

GNU General Public License v3.0 or later

See LICENSE to see the full text.

Author Information

  • Ansible Cloud Content Team