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

[tor-commits] [gettor/master] Restructure ansible playbooks



commit 6a5f274240c8f39880546868125be4f40cef4672
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Mon Sep 30 14:43:22 2019 +0200

    Restructure ansible playbooks
---
 playbooks/{update.yml => update-all.yml} |  0
 playbooks/update-gettor.yml              |  5 ++++
 playbooks/update-web.yml                 |  5 ++++
 playbooks/upload.yml                     |  1 +
 roles/gettor-web/tasks/main.yml          |  1 +
 roles/gettor/tasks/main.yml              |  6 ++++-
 roles/uploads/tasks/main.yml             | 46 ++------------------------------
 7 files changed, 19 insertions(+), 45 deletions(-)

diff --git a/playbooks/update.yml b/playbooks/update-all.yml
similarity index 100%
rename from playbooks/update.yml
rename to playbooks/update-all.yml
diff --git a/playbooks/update-gettor.yml b/playbooks/update-gettor.yml
new file mode 100644
index 0000000..08534e4
--- /dev/null
+++ b/playbooks/update-gettor.yml
@@ -0,0 +1,5 @@
+---
+- hosts:
+    - gettor
+  roles:
+    - gettor
diff --git a/playbooks/update-web.yml b/playbooks/update-web.yml
new file mode 100644
index 0000000..bec2711
--- /dev/null
+++ b/playbooks/update-web.yml
@@ -0,0 +1,5 @@
+---
+- hosts:
+    - gettor
+  roles:
+    - gettor-web
diff --git a/playbooks/upload.yml b/playbooks/upload.yml
index a5c0a84..b367df5 100644
--- a/playbooks/upload.yml
+++ b/playbooks/upload.yml
@@ -3,3 +3,4 @@
     - gettor
   roles:
     - uploads
+    - gettor
diff --git a/roles/gettor-web/tasks/main.yml b/roles/gettor-web/tasks/main.yml
index 9e821f1..c1f4aff 100644
--- a/roles/gettor-web/tasks/main.yml
+++ b/roles/gettor-web/tasks/main.yml
@@ -11,6 +11,7 @@
     dest: /srv/gettor.torproject.org/home/gettor-web/
     clone: no
     update: yes
+  when: stat_git_result.stat.exists
 
 - name: create virtualenv
   command: >
diff --git a/roles/gettor/tasks/main.yml b/roles/gettor/tasks/main.yml
index 729d86b..aad7d46 100644
--- a/roles/gettor/tasks/main.yml
+++ b/roles/gettor/tasks/main.yml
@@ -2,7 +2,7 @@
 - name: check if repository exists
   stat:
     path: "{{ gettor_path }}/.git/config"
-  register: stat_result
+  register: stat_git_result
 
 - name: update gettor source
   git:
@@ -11,6 +11,7 @@
     dest: /srv/gettor.torproject.org/home/gettor/
     clone: no
     update: yes
+  when: stat_git_result.stat.exists
 
 - name: Check that the gmail test password file exists
   stat:
@@ -63,3 +64,6 @@
   args:
     chdir: "{{ gettor_path }}"
     executable: /bin/bash
+
+- name: run smoke gun test
+  shell: bin/gettor_check $(/srv/gettor.torproject.org/home/gettor/.config/test_gettor_gmail.key)
diff --git a/roles/uploads/tasks/main.yml b/roles/uploads/tasks/main.yml
index 1a16d43..00d8d33 100644
--- a/roles/uploads/tasks/main.yml
+++ b/roles/uploads/tasks/main.yml
@@ -1,48 +1,6 @@
 ---
-- 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
+  shell: scripts/update_files
   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
+    executable: /bin/bash

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