Commit 01a3a4f1 by Nadeem Shahzad Committed by GitHub

Merge pull request #3834 from edx/nadeem/splunk-config-backups-play

splunk-s3-backup-play
parents a4b6878e ebbf09ae
- name: Backup splunk configurations
hosts: all
become: True
vars:
splunk_config_dir: "/opt/splunk/etc"
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 }}"
tasks:
- set_fact:
date: "{{ lookup('pipe', 'date +%Y-%m-%dT%H%M') }}"
- name: archive splunk configuration 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 }}
- name: cleanup backup file
file:
path: "{{ splunk_s3_backup_tempdir }}/{{ splunk_config_archive }}"
state: absent
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