cce-search-ansible/update-frontend-prod.yml

38 lines
1.1 KiB
YAML

- hosts: cce_frontend_prod
tasks:
- name: Bring down the app if it is running (ignore error msg)
command: "killall flask"
ignore_errors: true
- name: Pull from GitHub
git:
accept_hostkey: true
force: true
update: true
repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}"
# Source: https://github.com/pypa/pipenv/issues/363#issuecomment-421310544
- name: Check for venv
ignore_errors: true
command: "pipenv --venv"
args:
chdir: "{{ frontend_project_path }}"
register: pipenv_venv_check_cmd
changed_when:
- ('No virtualenv' not in pipenv_venv_check_cmd.stderr)
- name: Run pipenv install
command: "pipenv install"
args:
chdir: "{{ frontend_project_path }}"
when:
- ('No virtualenv' in pipenv_venv_check_cmd.stderr)
# Source: https://ansibledaily.com/execute-detached-process-with-ansible/
- name: Launch app
shell: "(nohup pipenv run flask run </dev/null >/dev/null 2>&1 &)"
args:
chdir: "{{ frontend_project_path }}"