summaryrefslogtreecommitdiff
path: root/roles/subdap/tasks
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2015-08-25 19:23:43 +0200
committerChristian Franke <nobody@nowhere.ws>2015-08-25 19:23:43 +0200
commitaf66612e6014bea48458125cda72d73c51bc3c20 (patch)
tree49cee76d579149a9fd800225303ee31be79cf3eb /roles/subdap/tasks
Initial commit
Diffstat (limited to 'roles/subdap/tasks')
-rw-r--r--roles/subdap/tasks/as_subdap.yaml23
-rw-r--r--roles/subdap/tasks/main.yaml34
2 files changed, 57 insertions, 0 deletions
diff --git a/roles/subdap/tasks/as_subdap.yaml b/roles/subdap/tasks/as_subdap.yaml
new file mode 100644
index 0000000..f0b9073
--- /dev/null
+++ b/roles/subdap/tasks/as_subdap.yaml
@@ -0,0 +1,23 @@
+---
+- name: Clone subdap code
+ git:
+ dest=/var/subdap/src
+ repo=git://git.sublab.org/subdap
+ accept_hostkey=yes
+
+- name: Setup virtualenv for subdap
+ pip:
+ name={{ item }}
+ virtualenv=/var/subdap/venv
+ virtualenv_site_packages=yes
+ with_items:
+ - cherrypy
+ - egenix-mx-base
+ - genshi
+ - gunicorn
+
+- name: Create accountservice.py
+ template:
+ dest=/var/subdap/src/accountservice.py
+ src=accountservice.py.j2
+ mode=0600
diff --git a/roles/subdap/tasks/main.yaml b/roles/subdap/tasks/main.yaml
new file mode 100644
index 0000000..6375e6e
--- /dev/null
+++ b/roles/subdap/tasks/main.yaml
@@ -0,0 +1,34 @@
+---
+- apt: name={{ item }} state=present
+ with_items:
+ - git
+ - python-ldap
+ - python-lxml
+ - python-m2crypto
+ - virtualenv
+
+- name: Create subdap group
+ group: name=subdap
+
+- name: Create subdap user
+ user: name=subdap group=subdap home=/var/subdap
+
+- include: as_subdap.yaml
+ become: yes
+ become_method: su
+ become_user: subdap
+ notify:
+ - Restart subdap
+
+- name: Create systemd service
+ template:
+ src=subdap.service.j2
+ dest=/etc/systemd/system/subdap.service
+ notify:
+ - Reload systemd daemons
+ - Restart subdap
+
+- name: Enable systemd service
+ service:
+ name: subdap
+ enabled: yes