From b18d6064f045e3aed6b83f7ff7466cbc051c15c5 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Thu, 2 Apr 2020 11:19:26 -0400 Subject: roles/healthchecks/main: Add maintenance and basic test --- roles/healthchecks/main.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/roles/healthchecks/main.yml b/roles/healthchecks/main.yml index ed41d76..c8f2e90 100644 --- a/roles/healthchecks/main.yml +++ b/roles/healthchecks/main.yml @@ -71,7 +71,9 @@ ./manage.py migrate args: chdir: "{{ healthchecks_home }}" - creates: hc.sqlite + changed_when: false + register: output + - debug: var=output - name: Setting up application assets blockinfile: @@ -101,6 +103,21 @@ SECRET = "{{ secret_key }}" create: yes + - name: Performing maintenance + shell: | + . bin/activate + ./manage.py prunepings + ./manage.py prunenotifications + ./manage.py pruneusers + ./manage.py prunetokenbucket + ./manage.py pruneflips + ./manage.py compress + args: + chdir: "{{ healthchecks_home }}" + changed_when: false + register: output + - debug: var=output + become: true become_user: "{{ healthchecks_user }}" @@ -120,3 +137,12 @@ - name: Waiting for supervisor to become active wait_for: port: 9100 + + - name: Waiting for application to become active + wait_for: + port: 8000 + + - name: Testing if page exists + uri: + url: http://0.0.0.0:8000 + return_content: yes -- cgit v1.2.3