summaryrefslogtreecommitdiff
path: root/backup_git.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'backup_git.yaml')
-rw-r--r--backup_git.yaml23
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