Jacob Anders 3c5377ce92 Auto-set ansible_python_interpreter when in venv
Ansible doesn't seem to correctly configure python interpreter
while running in a virtual environment and defaults to the system
wide installation. This can lead to missing dependencies and/or
version mismatch issues. This change adds automatic configuration
of ansible_python_interpreter value based on VENV environment
variable for each of the roles provided by bifrost.

Change-Id: I0bc6a0ee7519bca0fe81eb74349427681269a740
2020-07-24 09:38:58 +10:00

20 lines
694 B
YAML

---
# Global options
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
bifrost_venv_env:
VIRTUAL_ENV: "{{ bifrost_venv_dir }}"
PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env
enable_venv: true
skip_install: false
source_install: false
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
# Pip options
extra_args:
pip_install_retries: 5
pip_install_delay: 10
reqs_git_folder: /opt/stack/requirements
state: present
version:
upper_constraints_file: "{{ lookup('env', 'UPPER_CONSTRAINTS_FILE') | default(reqs_git_folder + '/upper-constraints.txt', True) }}"