extensions-website/playbooks/tasks/deploy.yaml
Anna Sirota 061ae149d3 Separate production-only deps (#16)
This is to avoid having to install anything PosgreSQL-related for local development

Reviewed-on: #16
2024-02-06 10:29:15 +01:00

71 lines
1.9 KiB
YAML

---
- import_tasks: copy_error_pages.yaml
become: true
become_user: "{{ user }}"
- name: Deleting {{ dir.source }}/.venv if it exists
become: true
become_user: "{{ user }}"
ansible.builtin.file:
path: "{{ dir.source }}/.venv"
state: absent
when: delete_venv
tags:
- pip
- name: Install Python requirements in {{ dir.source }}/.venv
become: true
become_user: "{{ user }}"
ansible.builtin.pip:
requirements: "{{ dir.source }}/requirements_prod.txt"
virtualenv: "{{ dir.source }}/.venv"
virtualenv_command: python{{ python_version }} -m venv
chdir: "{{ dir.source }}"
tags:
- pip
- name: Preparing to run database migrations
become: true
become_user: "{{ user }}"
tags:
- migrate
block:
- name: Displaying database migrations
import_tasks: managepy.yaml
vars:
command: migrate --plan
- name: Displaying database migrations
ansible.builtin.debug:
var: management_command_output.stdout
- name: Confirming database migrations
when:
- management_command_output.stdout | length > 0
- ('No planned migration operations' not in management_command_output.stdout)
ansible.builtin.pause:
prompt: Press return to continue. Press Ctrl+c and then "a" to abort.
- name: Running database migrations
when:
- management_command_output.stdout | length > 0
- ('No planned migration operations' not in management_command_output.stdout)
import_tasks: managepy.yaml
vars:
command: migrate
changed_when:
- management_command_output.stdout | length > 0
- ('No planned migration operations' not in management_command_output.stdout)
- import_tasks: managepy.yaml
become: true
become_user: "{{ user }}"
vars:
command: collectstatic --noinput
changed_when: true
tags:
- collectstatic
notify:
- restart service
- test nginx
- reload nginx