You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/roles/backup_directory/tasks/main.yml

21 lines
709 B
YAML

---
- name: Determine backup timestamp.
ansible.builtin.set_fact: backup_time="{{ ansible_date_time.iso8601 }}"
- name: Compress Directory
community.general.archive:
path: "{{ backup.path }}"
dest: /tmp/backup.tar.gz
- name: Upload backups to S3
amazon.aws.aws_s3:
s3_url: "{{ docker_backup_aws_s3_url }}"
bucket: "{{ docker_backup_aws_s3_bucket }}"
object: "{{ backup.s3_name }}-{{ backup_time }}.tar.gz"
src: /tmp/backup.tar.gz
aws_access_key: "{{ docker_backup_aws_s3_aws_access_key }}"
aws_secret_key: "{{ docker_backup_aws_s3_aws_secret_key }}"
region: "{{ docker_backup_aws_s3_region }}"
mode: put
permission: "{{ docker_backup_aws_s3_permissions }}"