Commit f8e6cfde by nadeemshahzad

added prefix and timestamp(H/M) to backup archive

parent d0e0aa3f
......@@ -2,17 +2,16 @@
hosts: all
vars:
splunk_config_dir: "/opt/splunk/etc"
splunk_config_archive: "{{ date }}.tar.gz"
splunk_host: "{{ splunk_host_id }}"
splunk_config_archive: "{{ splunk_host }}-{{ date }}.tar.gz"
splunk_s3_backup_tempdir: "/var/tmp"
splunk_s3_bucket: "{{ SPLUNK_S3_BACKUPS_BUCKET }}"
date: "{{ lookup('pipe', 'date +%Y-%m-%d') }}"
splunk_s3_bucket: "{{ splunk_s3_backups_bucket }}"
date: "{{ lookup('pipe', 'date +%Y-%m-%dT%H%M') }}"
tasks:
- name: archive splunk configuration dir
command: >
tar -cpzf "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}" {{ splunk_config_dir }}
command: tar -cpzf "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}" {{ splunk_config_dir }}
- name: copy tarball to s3 bucket
command: >
aws s3 cp "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}" s3://{{ splunk_s3_bucket }}
command: aws s3 cp "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}" s3://{{ splunk_s3_bucket }}
- name: cleanup backup file
file:
path: "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment