This role with sync the contents of two s3 buckets and optionally report the results to slack
The remote running this role must have awscli and boto3 installed via pip.
# Main Input Variable
sync_s3_bucket:
name: # Optional, name to associate job with; this will be used when reporting to slack
source_s3:
bucket: # Required, the bucket of the s3 to be synced from
key_prefix: # Optional, key prefix if syncing a specific folder is desired
dest_s3:
bucket: # Required, the bucket of the s3 to be synced to
key_prefix: # Optional, key prefix if syncing to a specific folder is desired
notify_slack: no # Optional, output results of job to slack, requires the sync_s3_bucket_slack variable to be set
# Slack
sync_s3_bucket_slack: # Follows the same logic as the ansible slack module. Only requirement is the token. There is a default sync_s3_bucket_slack_attachments
# variable that can be overriden by sync_s3_bucket_slack.attachments if desired
# Async control variables # The following options control how long the play will wait for the aws s3 sync job to finish
sync_s3_bucket_sync_async: 18000
sync_s3_bucket_sync_retries: 300
sync_s3_bucket_sync_delay: 60
# Sync buckets and report to slack
sync_s3_bucket:
name: Sync Bucket A to Bucket B
source_s3:
bucket: bucket-A
dest_s3: bucket-B
notify_slack: yes
sync_s3_bucket_slack:
token: 'slack/token/to/desired/channel/here' # By default number of objects and estimated size of sync are displayed in report
BSD
Solomon Hilliard for Emory Libraries