summaryrefslogtreecommitdiff
path: root/roles/gitserver
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2015-09-04 02:07:14 +0200
committerChristian Franke <nobody@nowhere.ws>2015-09-04 02:07:14 +0200
commitd7fb136d7d752aef8a100854f265d984f79c2ff0 (patch)
tree4e7479537888a5c3ebae398bb5a106c9b47877e9 /roles/gitserver
parentdd37acbfbd5a0c8db622a9ffae7c81e96b6b036a (diff)
Use s3 to backup/restore git
Diffstat (limited to 'roles/gitserver')
-rw-r--r--roles/gitserver/tasks/main.yaml2
-rw-r--r--roles/gitserver/tasks/restore_gitolite.yaml34
2 files changed, 28 insertions, 8 deletions
diff --git a/roles/gitserver/tasks/main.yaml b/roles/gitserver/tasks/main.yaml
index 7d1e3d7..aca95f4 100644
--- a/roles/gitserver/tasks/main.yaml
+++ b/roles/gitserver/tasks/main.yaml
@@ -1,6 +1,6 @@
---
- name: Install gitolite
- apt: name={{ item }}
+ apt: name={{ item }} update_cache=yes
with_items:
- gitolite3
- git-daemon-run
diff --git a/roles/gitserver/tasks/restore_gitolite.yaml b/roles/gitserver/tasks/restore_gitolite.yaml
index c937ad1..78a9a0b 100644
--- a/roles/gitserver/tasks/restore_gitolite.yaml
+++ b/roles/gitserver/tasks/restore_gitolite.yaml
@@ -10,19 +10,34 @@
chdir: /var/lib/gitolite
creates: /var/lib/gitolite/.gitolite/conf
+#- name: Get repository backup
+# get_url:
+# url=https://oberon.sublab.org/protected/repositories.tar.gz
+# url_username="{{download_user}}"
+# url_password="{{download_pass}}"
+# validate_certs=no
+# dest=/var/lib/gitolite/repositories.tar.gz
+
- name: Get repository backup
- get_url:
- url=https://oberon.sublab.org/protected/repositories.tar.gz
- url_username="{{download_user}}"
- url_password="{{download_pass}}"
- validate_certs=no
- dest=/var/lib/gitolite/repositories.tar.gz
+ s3:
+ bucket=devops-sublab
+ object=git-backup.tar.asc
+ dest=/var/lib/gitolite/repositories.tar.asc
+ mode=get
+ aws_access_key="{{aws_access_key}}"
+ aws_secret_key="{{aws_secret_key}}"
+ region=eu-central-1
+
+- name: Decrypt backup
+ shell: gpg --decrypt --passphrase "{{aws_encryption_key}}" repositories.tar.asc > repositories.tar
+ args:
+ chdir: /var/lib/gitolite
- name: Create directory for backup unpack
file: name=/var/lib/gitolite/old-repositories state=directory
- name: Unpack repository backup
- shell: tar -x --strip-components=1 -f ../repositories.tar.gz
+ shell: tar -x --strip-components=1 -f ../repositories.tar
args:
chdir: /var/lib/gitolite/old-repositories
creates: /var/lib/gitolite/old-repositories/gitolite-admin.git
@@ -42,3 +57,8 @@
shell: ./restore-backup.sh
args:
chdir: /var/lib/gitolite
+
+- name: Cleanup backup
+ shell: rm -rf repositories.tar.asc repositories.tar old-repositories
+ args:
+ chdir: /var/lib/gitolite