[tor-commits] [gettor/master] Continue with ansible recipes

hiro at torproject.org hiro at torproject.org
Fri Aug 30 16:46:14 UTC 2019


commit 754da82ddd16f83386cc2ba84acb88dc8239961a
Author: hiro <hiro at torproject.org>
Date:   Fri Aug 30 18:46:09 2019 +0200

    Continue with ansible recipes
---
 ansible.cfg                            |  5 -----
 playbooks/all.yml                      |  3 +++
 roles/gettor/tasks/db.yml              | 13 +++++++++++++
 roles/gettor/tasks/main.yml            |  1 +
 roles/gettor/tasks/source.yml          | 23 +++++++++++++++++++++++
 roles/gettor/meta/main.yml => site.yml |  0
 6 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/ansible.cfg b/ansible.cfg
index c55ed59..23b801f 100644
--- a/ansible.cfg
+++ b/ansible.cfg
@@ -1,16 +1,11 @@
 [defaults]
 roles_path = ./roles
-library = /usr/share/ansible:./library
-inventory = inventories/current,inventories/current/secrets
 
 # google for errors more easily
 module_lang=en_US.UTF-8
 
 display_failed_stderr = true
 
-pipelining = True
-validate_certs=False
-
 # I want no cows here
 nocows = 1
 
diff --git a/playbooks/all.yml b/playbooks/all.yml
new file mode 100644
index 0000000..9ba7505
--- /dev/null
+++ b/playbooks/all.yml
@@ -0,0 +1,3 @@
+---
+gettor_repo: https://git.torproject.org/gettor.git
+gettor_path: /home/gettor/gettor
diff --git a/roles/gettor/tasks/db.yml b/roles/gettor/tasks/db.yml
index e69de29..9a16a51 100644
--- a/roles/gettor/tasks/db.yml
+++ b/roles/gettor/tasks/db.yml
@@ -0,0 +1,13 @@
+---
+
+- name: export stats
+  command: >
+    {{ gettor_path }}/scripts/export_stats
+
+- name: create database
+  command: >
+    {{ gettor_path }}/scripts/create_db -n -c -o
+
+- name: add links
+  command: >
+    {{ gettor_path }}/scripts/add_links_to_db -f gettor.db
diff --git a/roles/gettor/tasks/main.yml b/roles/gettor/tasks/main.yml
new file mode 100644
index 0000000..6aaa7dc
--- /dev/null
+++ b/roles/gettor/tasks/main.yml
@@ -0,0 +1 @@
+- import_tasks: db.yml
diff --git a/roles/gettor/tasks/source.yml b/roles/gettor/tasks/source.yml
new file mode 100644
index 0000000..33b7978
--- /dev/null
+++ b/roles/gettor/tasks/source.yml
@@ -0,0 +1,23 @@
+---
+- name: check if repository exists
+  stat:
+    path: "{{ gettor_path }}/.git/config"
+  register: stat_result
+
+- name: checkout some stuff
+  command: git checkout -- db/schema.rb locale
+  args:
+    chdir: "{{ gettor_path }}"
+  when: stat_result.stat.exists
+
+- name: update gettor source
+  git:
+    repo: "{{ gettor_repo }}"
+    dest: "{{ gettor_path }}"
+    umask: '022'
+  diff: false
+  when: not ansible_check_mode
+  notify:
+    - restart gitlab-mailroom
+    - restart gitlab-sidekiq
+    - reload gitlab-unicorn
diff --git a/roles/gettor/meta/main.yml b/site.yml
similarity index 100%
rename from roles/gettor/meta/main.yml
rename to site.yml



More information about the tor-commits mailing list