2024-07-12 20:25:36 +03:30
|
|
|
---
|
|
|
|
- name: Create tar file with dynamic date
|
|
|
|
hosts: all
|
|
|
|
tasks:
|
|
|
|
- name: Set current date
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
current_date: "{{ lookup('pipe', 'date +%Y-%m-%d') }}"
|
|
|
|
|
|
|
|
- name: Archive volumes
|
|
|
|
ansible.builtin.archive:
|
|
|
|
path: /var/lib/docker/volumes # Replace with the path of the directory or files you want to archive
|
|
|
|
dest: "/root/backups/volumes-{{ current_date }}.tar.gz" # Replace with the desired destination path
|
|
|
|
format: gz
|
2024-07-12 20:45:14 +03:30
|
|
|
- name: Upload tar file to S3
|
|
|
|
ansible.builtin.command:
|
2024-07-12 20:50:36 +03:30
|
|
|
cmd: "s3cmd put /root/backups/volumes-{{ current_date }}.tar.gz s3://eron/i3/"
|