blender-studio/playbooks/tasks/deploy.yaml
Anna Sirota 41ce6f5780 Replace poetry with requirements{,_dev,_prod}.txt
Accidental backward-incompatible changes appear regularly in poetry,
which leads to a regular chore of fixing this part of tooling,
or having to stay on the old version of it for a very long time,
which is bound to break.
2024-07-01 19:07:09 +02:00

72 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:
- reload service
- restart background
- test nginx
- reload nginx