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

[tor-commits] [gettor/master] Fix update playbook, add upload playbook



commit c0469d37ccfd145c7b598522628aefc56ca23867
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Thu Sep 12 14:18:27 2019 +0200

    Fix update playbook, add upload playbook
---
 playbooks/upload.yml         |  5 +++++
 roles/gettor/tasks/main.yml  |  2 +-
 roles/uploads/tasks/main.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/playbooks/upload.yml b/playbooks/upload.yml
new file mode 100644
index 0000000..a5c0a84
--- /dev/null
+++ b/playbooks/upload.yml
@@ -0,0 +1,5 @@
+---
+- hosts:
+    - gettor
+  roles:
+    - uploads
diff --git a/roles/gettor/tasks/main.yml b/roles/gettor/tasks/main.yml
index 89298f4..767518c 100644
--- a/roles/gettor/tasks/main.yml
+++ b/roles/gettor/tasks/main.yml
@@ -18,7 +18,7 @@
 
 - name: create virtualenv
   command: >
-    virtualenv {{ gettor_path }}/venv
+    virtualenv -p python3 {{ gettor_path }}/venv
   args:
     chdir: "{{ gettor_path }}"
 
diff --git a/roles/uploads/tasks/main.yml b/roles/uploads/tasks/main.yml
new file mode 100644
index 0000000..1a16d43
--- /dev/null
+++ b/roles/uploads/tasks/main.yml
@@ -0,0 +1,48 @@
+---
+- name: check if repository exists
+  stat:
+    path: "{{ gettor_path }}/.git/config"
+  register: stat_result
+
+- name: update gettor source
+  git:
+    repo: https://git.torproject.org/gettor.git
+    version: master
+    dest: /srv/gettor.torproject.org/home/gettor/
+    clone: no
+    update: yes
+
+- name: upload files
+  command: >
+    {{ gettor_path }}/scripts/update_files
+
+- name: create virtualenv
+  command: >
+    virtualenv -p python3 {{ gettor_path }}/venv
+  args:
+    chdir: "{{ gettor_path }}"
+
+- name: activate virtualenv
+  command: . {{ gettor_path }}/venv/bin/activate
+
+- name: export stats
+  command: >
+    {{ gettor_path }}/scripts/export_stats
+
+- name: create database
+  command: >
+    {{ gettor_path }}/venv/bin/python3 {{ gettor_path }}/scripts/create_db -n -c -o -f gettor.db
+
+- name: add links
+  command: >
+    {{ gettor_path }}/venv/bin/python3 {{ gettor_path }}/scripts/add_links_to_db -f gettor.db
+
+- name: stop gettor
+  command: >
+    ./bin gettor_service stop
+  args:
+    chdir: "{{ gettor_path }}"
+
+- name: start gettor
+  command: >
+    ./bin gettor_service start

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