diff options
author | Christian Franke <nobody@nowhere.ws> | 2015-09-04 02:07:14 +0200 |
---|---|---|
committer | Christian Franke <nobody@nowhere.ws> | 2015-09-04 02:07:14 +0200 |
commit | d7fb136d7d752aef8a100854f265d984f79c2ff0 (patch) | |
tree | 4e7479537888a5c3ebae398bb5a106c9b47877e9 /backup_git.yaml | |
parent | dd37acbfbd5a0c8db622a9ffae7c81e96b6b036a (diff) |
Use s3 to backup/restore git
Diffstat (limited to 'backup_git.yaml')
-rw-r--r-- | backup_git.yaml | 23 |
1 files changed, 23 insertions, 0 deletions
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 |