aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/sz-ds
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-08-29 23:08:48 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-08-30 10:19:27 +0200
commitf8accf692c69924a4fca8714bb4fb2a5eab12d0e (patch)
treef70e5445a81567b479d7e1e6fa1ffcba707bfeae /ansible/roles/sz-ds
parent8b2f8441ccb110427078e47c76a8098f2677a54d (diff)
downloadinfra-f8accf692c69924a4fca8714bb4fb2a5eab12d0e.tar.gz
infra-f8accf692c69924a4fca8714bb4fb2a5eab12d0e.tar.bz2
infra-f8accf692c69924a4fca8714bb4fb2a5eab12d0e.tar.xz
infra-f8accf692c69924a4fca8714bb4fb2a5eab12d0e.zip
sz-ds: flyway migrations.
Diffstat (limited to 'ansible/roles/sz-ds')
-rw-r--r--ansible/roles/sz-ds/handlers/main.yml2
-rw-r--r--ansible/roles/sz-ds/tasks/flyway.yml11
-rw-r--r--ansible/roles/sz-ds/tasks/sz-ds-app.yml4
3 files changed, 8 insertions, 9 deletions
diff --git a/ansible/roles/sz-ds/handlers/main.yml b/ansible/roles/sz-ds/handlers/main.yml
index 846f076..da1ca2e 100644
--- a/ansible/roles/sz-ds/handlers/main.yml
+++ b/ansible/roles/sz-ds/handlers/main.yml
@@ -3,3 +3,5 @@
name: sz-ds
state: restarted
+- name: flyway migrate
+ shell: sudo -iu sz-ds flyway migrate
diff --git a/ansible/roles/sz-ds/tasks/flyway.yml b/ansible/roles/sz-ds/tasks/flyway.yml
index c34ef44..d3c8922 100644
--- a/ansible/roles/sz-ds/tasks/flyway.yml
+++ b/ansible/roles/sz-ds/tasks/flyway.yml
@@ -2,14 +2,13 @@
file:
state: directory
path: /opt/sz-ds/flyway
-- template:
+- name: /opt/sz-ds/bin/flyway
+ template:
src: opt/sz-ds/bin/flyway.j2
dest: /opt/sz-ds/bin/flyway
- become: no
-# mode: a=rx
- name: /etc/sz-ds/flyway.conf
tags: update-password
- file:
+ copy:
dest: /etc/sz-ds/flyway.conf
content: |
flyway.url=jdbc:postgresql://localhost/sz-ds
@@ -18,13 +17,13 @@
flyway.locations=filesystem:/opt/sz-ds/src/SweetzpotCentral/data-server/migrations
flyway.schemas=public
-
- name: Download and extract Flyway {{ flyway_version }}
unarchive:
src: "https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/{{ flyway_version }}/flyway-commandline-{{ flyway_version }}.zip"
dest: /opt/sz-ds/flyway
creates: "/opt/sz-ds/flyway/flyway-{{ flyway_version }}"
remote_src: yes
-- file:
+- name: chmod +x flyway
+ file:
path: "/opt/sz-ds/flyway/flyway-{{ flyway_version }}/flyway"
mode: a=rx
diff --git a/ansible/roles/sz-ds/tasks/sz-ds-app.yml b/ansible/roles/sz-ds/tasks/sz-ds-app.yml
index 78e300c..d89ade3 100644
--- a/ansible/roles/sz-ds/tasks/sz-ds-app.yml
+++ b/ansible/roles/sz-ds/tasks/sz-ds-app.yml
@@ -13,7 +13,7 @@
- name: git pull
tags: sz-ds-pull
notify:
-# - flyway migrate
+ - flyway migrate
- restart sz-ds
register: git_checkout
git:
@@ -36,6 +36,4 @@
virtualenv_python: python3
chdir: /opt/sz-ds/src/SweetzpotCentral/data-server
requirements: requirements.txt
-# editable: true
extra_args: --trusted-host github.com --process-dependency-links
-