summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/common/tasks/main.yaml3
-rw-r--r--roles/gitserver/tasks/main.yaml2
-rw-r--r--roles/gitserver/tasks/restore_gitolite.yaml34
-rw-r--r--roles/repo_service/tasks/as_repo_service.yaml5
-rw-r--r--roles/repo_service/tasks/main.yaml14
-rw-r--r--roles/subdap/tasks/main.yaml1
6 files changed, 49 insertions, 10 deletions
diff --git a/roles/common/tasks/main.yaml b/roles/common/tasks/main.yaml
index 3bcffb7..73b5039 100644
--- a/roles/common/tasks/main.yaml
+++ b/roles/common/tasks/main.yaml
@@ -1,8 +1,9 @@
---
# General setup for my hosts
- name: Install common packages
- apt: name={{ item }} state=present
+ apt: name={{ item }} state=present update_cache=yes
with_items:
+ - git
- htop
- mtr
- ntp
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
diff --git a/roles/repo_service/tasks/as_repo_service.yaml b/roles/repo_service/tasks/as_repo_service.yaml
new file mode 100644
index 0000000..6b364d8
--- /dev/null
+++ b/roles/repo_service/tasks/as_repo_service.yaml
@@ -0,0 +1,5 @@
+---
+- name: Clone repo_service git
+ git:
+ repo=https://github.com/cfra/repo_service.git
+ dest=/var/lib/repo_service/src
diff --git a/roles/repo_service/tasks/main.yaml b/roles/repo_service/tasks/main.yaml
new file mode 100644
index 0000000..b17319c
--- /dev/null
+++ b/roles/repo_service/tasks/main.yaml
@@ -0,0 +1,14 @@
+---
+- name: Create repo_service group
+ group: name=repo_service
+
+- name: Create repo_service user
+ user:
+ name=repo_service
+ group=repo_service
+ home=/var/lib/repo_service
+
+- include: as_repo_service.yaml
+ become: yes
+ become_user: repo_service
+ become_method: su
diff --git a/roles/subdap/tasks/main.yaml b/roles/subdap/tasks/main.yaml
index 4d79aa1..5af24f6 100644
--- a/roles/subdap/tasks/main.yaml
+++ b/roles/subdap/tasks/main.yaml
@@ -1,7 +1,6 @@
---
- apt: name={{ item }} state=present update_cache=yes
with_items:
- - git
- python-ldap
- python-lxml
- python-m2crypto