A playbook to upload a file from a remote host to GCP Cloud Storage.
GCP user account with at minimum the storage.objectCreator IAM role or equivalent permissions.
- upload_file_to_cloud_storage_bucket_name: The name of the GCP storage bucket to upload the file to. Required
- upload_file_to_cloud_storage_file_path: Path to file to upload. Required
- upload_file_to_cloud_storage_host_name: Name of the remote host or group with file to upload. Default:
"all"
. - upload_file_to_cloud_storage_object_name: The name to give the object in cloud storage. If not provided, defaults to the base file name (without path) of
upload_file_to_cloud_storage_file_path
.
With GCP credentials set as ENV variables or included in vars, create vars and inventory files.
vars.yaml
:
---
upload_file_to_cloud_storage_bucket_name: my-bucket
upload_file_to_cloud_storage_file_path: /path/to/file/on/remote/host
inventory.ini
:
[all]
sample_host ansible_ssh_user=some_user ansible_host=xxx.xxx.xxx.xxx
Run the playbook:
ansible-playbook cloud.gcp_ops.upload_file_to_cloud_storage -e "@vars.yaml" -i inventory.ini
GNU General Public License v3.0 or later
See LICENCE to see the full text.
- Ansible Cloud Content Team