From d7fb136d7d752aef8a100854f265d984f79c2ff0 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 4 Sep 2015 02:07:14 +0200 Subject: Use s3 to backup/restore git --- backup_git.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backup_git.yaml (limited to 'backup_git.yaml') diff --git a/backup_git.yaml b/backup_git.yaml new file mode 100644 index 0000000..0a436df --- /dev/null +++ b/backup_git.yaml @@ -0,0 +1,23 @@ +- hosts: gitservers + vars_files: + - vars/aws.yaml + tasks: + - name: Ensure that boto is not installed via apt + apt: name=python-boto state=absent + - name: Ensure recent boto is installed + pip: name=boto state=present + - name: Create encrypted backup + shell: tar c repositories | gpg --symmetric --cipher-algo AES --passphrase "{{ aws_encryption_key }}" > repositories.tar.asc + args: + chdir: /var/lib/gitolite + - name: Upload backup to S3 + s3: + bucket=devops-sublab + object=git-backup.tar.asc + src=/var/lib/gitolite/repositories.tar.asc + mode=put + aws_access_key="{{aws_access_key}}" + aws_secret_key="{{aws_secret_key}}" + region=eu-central-1 + - name: Cleanup backup archive + file: path=/var/lib/gitolite/repositories.tar.asc state=absent -- cgit v1.2.1