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
This commit is contained in:
parent
f29bbf2d1d
commit
3c5377ce92
@ -27,3 +27,8 @@ iso_gen_utility: "mkisofs"
|
||||
|
||||
# Deprecated, remove in Queens release
|
||||
node_network_info: {}
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -3,3 +3,8 @@ http_boot_folder: /httpboot
|
||||
deploy_image_filename: "partition_image.raw"
|
||||
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
|
||||
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -25,3 +25,4 @@ 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
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -40,6 +40,7 @@ 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
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
||||
git_branch: master
|
||||
git_root: "/opt/stack"
|
||||
|
@ -24,3 +24,8 @@ wait_timeout: 1800
|
||||
|
||||
# Timeout for gathering facts.
|
||||
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -249,6 +249,7 @@ bifrost_venv_env:
|
||||
VIRTUAL_ENV: "{{ bifrost_venv_dir }}"
|
||||
PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env
|
||||
pydoc: "python -m pydoc"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
||||
# Authentication support
|
||||
# By default, bifrost was developed around being a toolkit
|
||||
|
@ -1,3 +1,8 @@
|
||||
---
|
||||
ironic_api_url: "http://localhost:6385"
|
||||
ironic_inspector_api_url: "http://localhost:5050"
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -42,7 +42,7 @@ bifrost_venv_env:
|
||||
VIRTUAL_ENV: "{{ bifrost_venv_dir }}"
|
||||
PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env
|
||||
pydoc: "python -m pydoc"
|
||||
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
||||
keystone:
|
||||
debug: true
|
||||
|
@ -7,6 +7,7 @@ bifrost_venv_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:
|
||||
|
@ -114,3 +114,8 @@ bifrost_install_sources:
|
||||
git_url: "{{ ipa_builder_git_url }}"
|
||||
git_branch: "{{ ipa_builder_git_branch }}"
|
||||
name: ironic-python-agent-builder
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -2,3 +2,8 @@
|
||||
node_ssh_pause: 10
|
||||
wait_timeout: 900
|
||||
multinode_testing: false
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -4,3 +4,8 @@ skip_package_install: false
|
||||
rabbitmq_package: rabbitmq-server
|
||||
rabbitmq_port: 5672
|
||||
rabbitmq_service: rabbitmq-server
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -2,3 +2,8 @@
|
||||
ironic_url: "http://localhost:6385/"
|
||||
noauth_mode: true
|
||||
wait_for_node_undeploy: false
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -1,3 +1,8 @@
|
||||
---
|
||||
ironic_url: "http://localhost:6385/"
|
||||
noauth_mode: true
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -18,3 +18,8 @@ noauth_mode: true
|
||||
|
||||
# Timeout for gathering facts.
|
||||
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
@ -8,3 +8,8 @@ inventory_dns: false
|
||||
|
||||
# Timeout for gathering facts.
|
||||
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"
|
||||
|
||||
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
|
||||
enable_venv: true
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
|
||||
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user