[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Update playbooks and add role for web



commit f9b6a7ad33046e29c4d9113ab7fdd79cfb995315
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Fri Sep 6 14:46:59 2019 +0200

    Update playbooks and add role for web
---
 playbooks/group_vars/all.yml    |  2 ++
 playbooks/update.yml            |  1 +
 roles/gettor-web/tasks/main.yml | 35 +++++++++++++++++++++++++++++++++++
 roles/gettor/tasks/main.yml     |  4 ++--
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/playbooks/group_vars/all.yml b/playbooks/group_vars/all.yml
index beb08b7..5a4c58f 100644
--- a/playbooks/group_vars/all.yml
+++ b/playbooks/group_vars/all.yml
@@ -1,3 +1,5 @@
 ---
 gettor_repo: https://git.torproject.org/gettor.git
 gettor_path: /srv/gettor.torproject.org/home/gettor
+gettor_web_path: /srv/gettor.torproject.org/home/gettor-web
+home_path: /srv/gettor.torproject.org/home/
diff --git a/playbooks/update.yml b/playbooks/update.yml
index 08534e4..1b08808 100644
--- a/playbooks/update.yml
+++ b/playbooks/update.yml
@@ -3,3 +3,4 @@
     - gettor
   roles:
     - gettor
+    - gettor-web
diff --git a/roles/gettor-web/tasks/main.yml b/roles/gettor-web/tasks/main.yml
new file mode 100644
index 0000000..8d383de
--- /dev/null
+++ b/roles/gettor-web/tasks/main.yml
@@ -0,0 +1,35 @@
+---
+- name: check if repository exists
+  stat:
+    path: "{{ gettor_web_path }}/.git/config"
+  register: stat_result
+
+- name: update gettor source
+  git:
+    repo: https://git.torproject.org/project/web/gettor-web.git
+    version: master
+    dest: /srv/gettor.torproject.org/home/gettor-web/
+    clone: no
+    update: yes
+
+- name: create virtualenv
+  command: >
+    virtualenv {{ gettor_path }}/venv
+  args:
+    chdir: "{{ gettor_path }}"
+
+- pip:
+    name: lektor
+    virtualenv: {{ gettor_web_path }}/venv
+
+- name: activate virtualenv
+  command: . {{ gettor_web_path }}/venv/bin/activate
+
+- name: lektor build
+  command: lektor build -O {{ home_path }}/www
+
+- name: update static component
+  command: >
+    static-update-component gettor.torproject.org
+  args:
+    chdir: "{{ gettor_web_path }}"
diff --git a/roles/gettor/tasks/main.yml b/roles/gettor/tasks/main.yml
index b56b288..89298f4 100644
--- a/roles/gettor/tasks/main.yml
+++ b/roles/gettor/tasks/main.yml
@@ -23,11 +23,11 @@
     chdir: "{{ gettor_path }}"
 
 - name: activate virtualenv
-  command: . { gettor_path }}/venv/bin/activate
+  command: . {{ gettor_path }}/venv/bin/activate
 
 - name: create database
   command: >
-    {{ gettor_path }}/venv/bin/python3 {{ gettor_path }}/scripts/create_db -n -c -o
+    {{ gettor_path }}/venv/bin/python3 {{ gettor_path }}/scripts/create_db -n -c -o -f gettor.db
 
 - name: add links
   command: >

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits