aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/sz-ds/files/etc/systemd/system/sz-ds.service1
-rw-r--r--ansible/roles/sz-ds/handlers/main.yml1
-rw-r--r--ansible/roles/sz-ds/tasks/sz-ds-app.yml15
-rw-r--r--ansible/roles/sz-ds/templates/etc/sz-ds/env.conf.j21
4 files changed, 12 insertions, 6 deletions
diff --git a/ansible/roles/sz-ds/files/etc/systemd/system/sz-ds.service b/ansible/roles/sz-ds/files/etc/systemd/system/sz-ds.service
index 5e55de4..95a903b 100644
--- a/ansible/roles/sz-ds/files/etc/systemd/system/sz-ds.service
+++ b/ansible/roles/sz-ds/files/etc/systemd/system/sz-ds.service
@@ -9,6 +9,7 @@ Restart=on-failure
User=sz-ds
Group=sz-ds
EnvironmentFile=/etc/sz-ds/env.conf
+EnvironmentFile=/etc/sz-ds/env-git.conf
[Install]
WantedBy=multi-user.target
diff --git a/ansible/roles/sz-ds/handlers/main.yml b/ansible/roles/sz-ds/handlers/main.yml
index da1ca2e..c8f3570 100644
--- a/ansible/roles/sz-ds/handlers/main.yml
+++ b/ansible/roles/sz-ds/handlers/main.yml
@@ -2,6 +2,7 @@
service:
name: sz-ds
state: restarted
+ daemon_reload: yes
- name: flyway migrate
shell: sudo -iu sz-ds flyway migrate
diff --git a/ansible/roles/sz-ds/tasks/sz-ds-app.yml b/ansible/roles/sz-ds/tasks/sz-ds-app.yml
index d89ade3..9bd13af 100644
--- a/ansible/roles/sz-ds/tasks/sz-ds-app.yml
+++ b/ansible/roles/sz-ds/tasks/sz-ds-app.yml
@@ -7,15 +7,19 @@
notify:
- restart sz-ds
- name: /etc/systemd/system/sz-ds.service
+ notify:
+ - flyway migrate
+ - restart sz-ds
copy:
src: etc/systemd/system/sz-ds.service
dest: /etc/systemd/system/sz-ds.service
+
- name: git pull
tags: sz-ds-pull
notify:
- flyway migrate
- restart sz-ds
- register: git_checkout
+ register: git_pull
git:
repo: "https://{{ sz_ds_secrets.github.username }}:{{ sz_ds_secrets.github.password }}@github.com/SweetzpotAS/SweetzpotCentral"
dest: /opt/sz-ds/src/SweetzpotCentral
@@ -23,10 +27,11 @@
- name: Update GIT_REVISION
tags: sz-ds-pull
- lineinfile:
- path: "/etc/sz-ds/env.conf"
- regexp: "^GIT_REVISION="
- line: "GIT_REVISION={{ git_checkout.after }}"
+ copy:
+ dest: "/etc/sz-ds/env-git.conf"
+ content: |
+ GIT_REVISION={{ git_pull.after }}
+- debug: msg=GIT_REVISION={{ git_pull.after }}
- name: sz-ds pip
notify: restart sz-ds
diff --git a/ansible/roles/sz-ds/templates/etc/sz-ds/env.conf.j2 b/ansible/roles/sz-ds/templates/etc/sz-ds/env.conf.j2
index 1e2cebb..aa70f73 100644
--- a/ansible/roles/sz-ds/templates/etc/sz-ds/env.conf.j2
+++ b/ansible/roles/sz-ds/templates/etc/sz-ds/env.conf.j2
@@ -1,3 +1,2 @@
-GIT_REVISION=
SQLALCHEMY_DATABASE_URI="postgresql://sz-ds-web:{{ sz_ds_secret.db_password_web }}@localhost/sz-ds"
SZ_CONFIG=/opt/sz-ds/src/SweetzpotCentral/data-server/config/config-{{ sz_ds_env }}.py