Remove support for non-venv deployments

It has been deprecated and untested since ussuri, time to move on.

Change-Id: Ieddda38b12d07a2a5c51650850b150dd82f332a9
This commit is contained in:
Dmitry Tantsur 2020-08-21 17:24:06 +02:00
parent 3bf9631ae5
commit 2cf21258af
41 changed files with 106 additions and 212 deletions

View File

@ -24,12 +24,9 @@ VENV = "/opt/stack/bifrost"
ANSIBLE = os.path.join(VENV, 'bin', 'ansible-playbook')
COMMON_ENV = {
'VENV': VENV,
'USE_VENV': 'true',
'ENABLE_VENV': 'true',
}
COMMON_PARAMS = [
'-e', 'ansible_python_interpreter=%s/bin/python3' % VENV,
'-e', 'enable_venv=true',
'-e', 'bifrost_venv_dir=%s' % VENV,
]
BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))

View File

@ -259,22 +259,13 @@ packages, Bifrost defaults to installing everything to a virtual environment.
``scripts/env-setup.sh`` will automatically create a virtual environment in
``/opt/stack/bifrost`` if it does not exist.
If you want to enable system-wide installing, set ``ENABLE_VENV`` to ``false``
before calling ``env-setup.sh``::
export ENABLE_VENV=false
.. warning::
This is not recommended and not tested. Future versions of Bifrost may
remove support of running outside of a virtual environment.
If you want to relocate the virtual environment, export the ``VENV`` variable
before calling ``env-setup.sh``::
export VENV=/path/to/my/venv
If you're using the ansible playbooks directly (without the helper scripts),
set the ``enable_venv`` and ``bifrost_venv_dir`` variables accordingly.
set the ``bifrost_venv_dir`` variables accordingly.
Pre-installation settings
=========================

View File

@ -11,7 +11,6 @@
UPPER_CONSTRAINTS_FILE: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/upper-constraints.txt"
WORKSPACE: "{{ ansible_user_dir }}/src/opendev.org"
USE_DHCP: "{{ use_dhcp | default(false) | bool | lower }}"
ENABLE_VENV: "{{ use_venv | default(true) | bool | lower }}"
ZUUL_BRANCH: "{{ zuul.branch }}"
BOOT_MODE: "{{ boot_mode | default('') }}"
TEST_VM_NODE_DRIVER: "{{ test_driver | default('ipmi') }}"

View File

@ -26,6 +26,5 @@ iso_gen_utility: "mkisofs"
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -5,6 +5,5 @@ 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -20,9 +20,8 @@ ipa_git_folder: /opt/stack/ironic-python-agent
reqs_git_folder: /opt/stack/requirements
ipa_builder_git_folder: /opt/stack/ironic-python-agent-builder
# Settings related to installing bifrost in a virtual environment
enable_venv: true
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -185,7 +185,7 @@
and ("debian" in dib_os_element or "ubuntu" in dib_os_element)
- name: "Initiate image build"
command: disk-image-create {{dib_arglist}}
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else {}) }}"
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env) }}"
when:
- not build_ramdisk | bool
- not test_image_present.stat.exists
@ -193,7 +193,7 @@
- not test_image_initramfs_present.stat.exists
- name: "Initiate ramdisk build"
command: ramdisk-image-create {{dib_arglist}}
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else {}) }}"
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env) }}"
when:
- build_ramdisk | bool
- not test_image_present.stat.exists

View File

@ -40,12 +40,11 @@ test_vm_machine: "pc-1.0"
# NOTE(pas-ha) not really tested with non-local qemu connections
test_vm_libvirt_uri: "{{ lookup('env', 'LIBVIRT_CONNECT_URI') | default('qemu:///system', true) }}"
# Settings related to installing bifrost in a virtual environment
enable_venv: true
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
git_branch: master
git_root: "/opt/stack"

View File

@ -98,12 +98,12 @@
- name: get list of nodes from virtualbmc
command: vbmc list
register: vbmc_list
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
# NOTE(NobodyCam): Space at the end of the find clause is required for proper matching.
- name: delete vm from virtualbmc if it is there
command: vbmc delete {{ vm_name }}
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: vbmc_list.stdout.find(vm_name) != -1
- set_fact:
@ -111,11 +111,11 @@
- name: plug vm into vbmc
command: vbmc add {{ vm_name }} --libvirt-uri {{ test_vm_libvirt_uri }} --port {{ virtual_ipmi_port }}
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: start virtualbmc
command: vbmc start {{ vm_name }}
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: get XML of the vm
virt:

View File

@ -1,15 +1,10 @@
{% if enable_venv | bool %}
{% set gunicorn = bifrost_venv_dir ~ '/bin/gunicorn' %}
{% else %}
{% set gunicorn = '/usr/local/bin/gunicorn' %}
{% endif %}
[Unit]
Description=Sushy Redfish Emulator
[Service]
Type=simple
Restart=on-failure
ExecStart={{ gunicorn }} sushy_tools.emulator.main:app \
ExecStart={{ bifrost_venv_dir }}/bin/gunicorn sushy_tools.emulator.main:app \
--bind {{ redfish_emulator_host }}:{{ redfish_emulator_port }} \
--env SUSHY_EMULATOR_CONFIG=/etc/redfish-emulator.conf \
--env FLASK_DEBUG=1 --workers 2 --threads 2 --timeout 90

View File

@ -1,12 +1,7 @@
{% if enable_venv | bool %}
{% set vbmcd = bifrost_venv_dir ~ '/bin/vbmcd' %}
{% else %}
{% set vbmcd = '/usr/local/bin/vbmcd' %}
{% endif %}
[Unit]
Description=Virtual BMC daemon
[Service]
Type=simple
Restart=on-failure
ExecStart={{ vbmcd }} --foreground
ExecStart={{ bifrost_venv_dir }}/bin/vbmcd --foreground

View File

@ -24,6 +24,5 @@ wait_timeout: 1800
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -257,12 +257,8 @@ inspector_store_data_in_nginx: Boolean value, default false. If true, this
### Virtual Environment Install
Bifrost can install ironic into a python virtual environment using the
following configuration options:
enable_venv: Enables virtual environment support. Boolean value; the default
is false. enable_venv is automatically defined as true if VENV
is set in the user's environment.
Bifrost installs ironic and other services into a python virtual environment
using the following configuration options:
bifrost_venv_dir: The full path of the virtual environment directory. The
default value is /opt/stack/bifrost. When VENV is set in

View File

@ -249,13 +249,12 @@ power_off_after_inspection: "{{ not fast_track|bool }}"
download_ipxe: false
# Settings related to installing bifrost in a virtual environment
enable_venv: true
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
pydoc: "python -m pydoc"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
# Authentication support
# By default, bifrost was developed around being a toolkit

View File

@ -22,11 +22,6 @@
noauth_mode | bool == true and enable_keystone is defined and
enable_keystone | bool == true
- name: "If VENV is set in the environment, enable installation into venv"
set_fact:
enable_venv: true
when: lookup('env', 'VENV') | length > 0
- block:
- name: "Ask systemd to reload configuration"
systemd:
@ -191,14 +186,14 @@
- name: "Create ironic DB Schema"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: >
ironic.database.host == 'localhost' and
test_created_db.changed | bool == true
- name: "Upgrade ironic DB Schema"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: >
ironic.database.host != 'localhost' or
test_created_db.changed | bool == false
@ -216,7 +211,7 @@
- name: "Get ironic-api & ironic-conductor install location"
shell: echo $(dirname $(which ironic-api))
register: ironic_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Set permissions for /var/lib/ironic for the ironic user"
file:

View File

@ -117,11 +117,11 @@
- name: "Upgrade inspector DB Schema"
command: ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade
become: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Inspector - Get ironic-inspector install location"
shell: echo $(dirname $(which ironic-inspector))
register: ironic_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Inspector - Place service"
template:
src: systemd_template.j2

View File

@ -37,14 +37,13 @@
owner=ironic
group=ironic
mode=0640
- name: "Symlinks from venv if using"
- name: "Symlinks from venv"
file:
state: link
path: "{{ ironic_rootwrap_dir }}/{{ item | basename }}"
src: "{{ item }}"
owner: root
group: root
when: enable_venv | bool == true
loop:
- "{{ bifrost_venv_dir }}/bin/ironic-rootwrap"
- "{{ bifrost_venv_dir }}/bin/ironic-inspector-rootwrap"

View File

@ -48,7 +48,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default"
user_domain_id: "default"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create service user for ironic"
@ -67,7 +67,7 @@
user_domain_id: "default"
update_password: always
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Associate ironic user to admin role"
@ -83,7 +83,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create keystone service record for ironic"
@ -100,7 +100,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Check ironic admin endpoint exists"
@ -116,7 +116,7 @@
no_log: true
register: test_ironic_admin_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Check ironic public endpoint exists"
command: |
@ -131,7 +131,7 @@
no_log: true
register: test_ironic_public_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Check ironic internal endpoint exists"
command: |
@ -146,7 +146,7 @@
no_log: true
register: test_ironic_internal_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Create ironic admin endpoint"
command: |
@ -159,7 +159,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal admin "{{ ironic.keystone.admin_url | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_admin_endpoint.rc != 0 or test_ironic_admin_endpoint.stdout == '[]'
- name: "Setting external Ironic public URL"
@ -178,7 +178,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal public "{{ ironic_public_url | default(ironic.keystone.public_url) | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_public_endpoint.rc != 0 or test_ironic_public_endpoint.stdout == '[]'
- name: "Setting internal Ironic URL"
@ -197,7 +197,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal internal "{{ ironic_private_url | default(ironic.keystone.internal_url) | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_internal_endpoint.rc != 0 or test_ironic_internal_endpoint.stdout == '[]'
- name: "Create baremetal_admin role"
@ -211,7 +211,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default"
user_domain_id: "default"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create baremetal_observer role"
@ -225,7 +225,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default"
user_domain_id: "default"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create baremetal project"
@ -242,7 +242,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default"
user_domain_id: "default"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create bifrost user"
@ -259,7 +259,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Associate bifrost user with baremetal_admin"
@ -275,5 +275,5 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true

View File

@ -48,7 +48,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Associate ironic_inspector user to admin role"
@ -64,7 +64,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Create keystone service record for ironic-inspector"
@ -81,7 +81,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Check ironic-inspector admin endpoint exists"
@ -96,7 +96,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_admin_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Check ironic-inspector public endpoint exists"
command: |
@ -110,7 +110,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_public_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Check ironic-inspector internal endpoint exists"
command: |
@ -124,7 +124,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_internal_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Create ironic-inspector admin endpoint"
command: |
@ -137,7 +137,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection admin "{{ ironic_inspector.keystone.admin_url | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_inspector_admin_endpoint.rc != 0 or test_ironic_inspector_admin_endpoint.stdout == '[]'
- name: "Setting external ironic-inspector public URL"
@ -160,7 +160,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection public "{{ ironic_inspector_public_url | default(ironic_inspector.keystone.public_url) | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_inspector_public_endpoint.rc != 0 or test_ironic_inspector_public_endpoint.stdout == '[]'
- name: "Setting internal ironic-inspector URL"
@ -179,7 +179,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection internal "{{ ironic_inspector_private_url | default(ironic_inspector.keystone.internal_url) | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: test_ironic_inspector_internal_endpoint.rc != 0 or test_ironic_inspector_internal_endpoint.stdout == '[]'
- name: "Create inspector_user user"
@ -197,7 +197,7 @@
user_domain_id: "default"
update_password: always
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
- name: "Associate inspector_user with baremetal_admin"
@ -213,5 +213,5 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true

View File

@ -11,12 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: "If VENV is set in the environment, enable installation into venv"
set_fact:
enable_venv: true
when: lookup('env', 'VENV') | length > 0
- name: "Perform ironic online data migrations"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: ironic.database.host != 'localhost'

View File

@ -46,7 +46,7 @@
- name: "Validate API access and at least one conductor"
command: baremetal conductor list -f value -c Hostname
environment: "{{ testing_env | combine(bifrost_venv_env if enable_venv else {}) }}"
environment: "{{ testing_env | combine(bifrost_venv_env) }}"
register: conductor_list
failed_when: conductor_list.rc != 0 or conductor_list.stdout | trim == ""
retries: 6
@ -77,7 +77,7 @@
- name: "Validate introspection API access"
command: baremetal introspection list
environment: "{{ testing_env | combine(bifrost_venv_env if enable_venv else {}) }}"
environment: "{{ testing_env | combine(bifrost_venv_env) }}"
register: introspection_list
retries: 6
delay: 5

View File

@ -3,9 +3,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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
enable_keystone: false
noauth_mode: true

View File

@ -41,13 +41,12 @@ file_url_port: 8080
http_boot_folder: /httpboot
# Settings related to installing bifrost in a virtual environment
enable_venv: true
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
pydoc: "python -m pydoc"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' if enable_venv | bool else '/usr/bin/python3' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
# Directory (on the controller) to keep the passwords
password_dir: "{{ lookup('env', 'HOME') }}/.config/bifrost"

View File

@ -13,21 +13,15 @@
---
# NOTE(TheJulia): There is significant commonality between this playbook
# and the bifrost bootstrap process.
- name: "If VENV is set in the environment, enable installation into venv"
set_fact:
enable_venv: true
uwsgi_venv: "{{ bifrost_venv_env.get('VIRTUAL_ENV', '') }}"
when: lookup('env', 'VENV') | length > 0
- name: "Get uwsgi install location"
shell: echo $(dirname $(which uwsgi))
register: uwsgi_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Get keystone-wsgi-admin location"
shell: echo $(dirname $(which keystone-wsgi-admin))
register: keystone_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
# NOTE(sean-k-mooney) only the MySQL db is started during bootstrapping.
# all other services are started in the Start phase.
@ -110,19 +104,19 @@
- name: "Apply/Update keystone DB Schema"
command: keystone-manage db_sync
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Setup Fernet key repositories"
command: >
keystone-manage fernet_setup
--keystone-user="{{ nginx_user }}" --keystone-group="{{ nginx_user }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Setup Keystone Credentials"
command: >
keystone-manage credential_setup
--keystone-user="{{ nginx_user }}" --keystone-group="{{ nginx_user }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
- name: "Setting external Keystone public URL"
set_fact:
@ -145,7 +139,7 @@
--bootstrap-public-url="{{ keystone_public_url | default(keystone.bootstrap.public_url) }}"
--bootstrap-internal-url="{{ keystone_private_url | default(keystone.bootstrap.internal_url) }}"
--bootstrap-region-id="{{ keystone.bootstrap.region_name }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
when: >
test_created_keystone_db.changed | bool == true and
keystone.bootstrap.enabled | bool == true and

View File

@ -61,7 +61,7 @@
project_domain_id: "default"
user_domain_id: "default"
wait: yes
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
environment: "{{ bifrost_venv_env }}"
no_log: true
ignore_errors: true
when:

View File

@ -6,9 +6,7 @@ threads = 2
plugin = python3
no-orphans = true
chmod-socket = 660
{% if uwsgi_venv is defined and uwsgi_venv | length > 0 %}
virtualenv = {{ uwsgi_venv }}
{% endif %}
virtualenv = {{ bifrost_venv_dir }}
socket = /run/uwsgi/keystone-admin.socket
pidfile = /run/uwsgi/keystone-admin.pid

View File

@ -6,9 +6,7 @@ threads = 2
plugin = python3
no-orphans = true
chmod-socket = 660
{% if uwsgi_venv is defined and uwsgi_venv | length > 0 %}
virtualenv = {{ uwsgi_venv }}
{% endif %}
virtualenv = {{ bifrost_venv_dir }}
socket = /run/uwsgi/keystone-public.socket
pidfile = /run/uwsgi/keystone-public.pid

View File

@ -4,10 +4,9 @@ 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
# Pip options
developer_mode: false

View File

@ -42,20 +42,7 @@
until: pip_package_install_done is succeeded
retries: "{{ pip_install_retries }}"
delay: "{{ pip_install_delay }}"
when: source_install | bool == false and enable_venv | bool
- name: "Install {{ package }} package from pip without virtualenv"
pip:
name: "{{ package }}"
state: "{{ state | default(omit) }}"
version: "{{ version | default(omit) }}"
extra_args: "{{ constraints_extra_args | default(extra_args) | default(omit) }}"
executable: /usr/bin/pip3
register: pip_package_install_done
until: pip_package_install_done is succeeded
retries: "{{ pip_install_retries }}"
delay: "{{ pip_install_delay }}"
when: source_install | bool == false and enable_venv | bool == false
when: not source_install | bool
- name: "Install requirements from {{ sourcedir }} using pip"
pip:
@ -66,7 +53,7 @@
retries: 5
delay: 10
when: source_install | bool
environment: "{{ bifrost_venv_env if (enable_venv | bool) else {} }}"
environment: "{{ bifrost_venv_env }}"
# NOTE(dtantsur): do not use constraints here, it does not work when the
# package itself is constrained.
@ -76,6 +63,6 @@
editable: "{{ developer_mode | bool }}"
extra_args: "{{ extra_args | default('') }}"
when: source_install | bool
environment: "{{ bifrost_venv_env if (enable_venv | bool) else {} }}"
environment: "{{ bifrost_venv_env }}"
when: not skip_install | bool

View File

@ -116,6 +116,5 @@ bifrost_install_sources:
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -4,6 +4,5 @@ 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -6,6 +6,5 @@ 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -3,6 +3,5 @@ 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -1,5 +1,4 @@
---
# 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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -17,6 +17,5 @@ ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ans
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -10,6 +10,5 @@ inventory_dns: false
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' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
No longer supports installation outside of a virtual environment. The
parameter ``enable_venv`` has been removed.

View File

@ -19,24 +19,17 @@ ANSIBLE_SOURCE_PATH=${ANSIBLE_SOURCE_PATH:-ansible${ANSIBLE_PIP_VERSION}}
BIFROST_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATHS:-}
PLAYBOOKS_LIBRARY_PATH=$(dirname $0)/../playbooks/library
if [[ -n "${VENV-}" ]]; then
${PIP} install "${ANSIBLE_SOURCE_PATH}"
ANSIBLE=${VENV}/bin/ansible
ANSIBLE_GALAXY=${VENV}/bin/ansible-galaxy
if [[ -z $BIFROST_COLLECTIONS_PATHS ]]; then
echo "Setting ANSIBLE_COLLECTIONS_PATHS to virtualenv"
export ANSIBLE_COLLECTIONS_PATHS=${VENV}/collections
BIFROST_COLLECTIONS_PATHS=$ANSIBLE_COLLECTIONS_PATHS
fi
if [[ -n "$ANSIBLE_COLLECTION_SOURCE_PATH" ]]; then
mkdir -p "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack"
ln -s "$ANSIBLE_COLLECTION_SOURCE_PATH" "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack/cloud"
fi
else
${PIP} install --user --upgrade "${ANSIBLE_SOURCE_PATH}"
ANSIBLE=${HOME}/.local/bin/ansible
ANSIBLE_GALAXY=${HOME}/.local/bin/ansible-galaxy
${PIP} install "${ANSIBLE_SOURCE_PATH}"
ANSIBLE=${VENV}/bin/ansible
ANSIBLE_GALAXY=${VENV}/bin/ansible-galaxy
if [[ -z $BIFROST_COLLECTIONS_PATHS ]]; then
echo "Setting ANSIBLE_COLLECTIONS_PATHS to virtualenv"
export ANSIBLE_COLLECTIONS_PATHS=${VENV}/collections
BIFROST_COLLECTIONS_PATHS=$ANSIBLE_COLLECTIONS_PATHS
fi
if [[ -n "$ANSIBLE_COLLECTION_SOURCE_PATH" ]]; then
mkdir -p "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack"
ln -s "$ANSIBLE_COLLECTION_SOURCE_PATH" "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack/cloud"
fi
# NOTE(pas-ha) the following is a temporary workaround for third-party CI
@ -71,12 +64,6 @@ fi
echo
echo "To use bifrost, do"
if [[ -n "${VENV-}" ]]; then
echo "source ${VENV}/bin/activate"
else
echo "Prepend ~/.local/bin to your PATH if it is not that way already.."
echo ".. or use full path to local Ansible at ~/.local/bin/ansible-playbook"
fi
echo "source ${VENV}/bin/activate"
echo "Then run playbooks as normal."
echo

View File

@ -6,10 +6,7 @@ declare -A PKG_MAP
# workaround: for latest bindep to work, it needs to use en_US local
export LANG=c
ENABLE_VENV=${ENABLE_VENV:-true}
if [[ "$ENABLE_VENV" != false ]]; then
export VENV=${VENV:-/opt/stack/bifrost}
fi
export VENV=${VENV:-/opt/stack/bifrost}
CHECK_CMD_PKGS=(
python3-devel
@ -89,22 +86,18 @@ if [ "${#EXTRA_PKG_DEPS[@]}" -ne 0 ]; then
done
fi
if [ -n "${VENV-}" ]; then
echo "NOTICE: Using virtualenv for this installation."
if [ ! -f ${VENV}/bin/activate ]; then
# only create venv if one doesn't exist
sudo -H -E python3 -m venv --system-site-packages ${VENV}
sudo -H -E chown -R ${USER} ${VENV}
fi
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.
set +u
. ${VENV}/bin/activate
set -u
VIRTUAL_ENV=${VENV}
else
echo "NOTICE: Not using virtualenv for this installation."
echo "NOTICE: Using virtualenv for this installation."
if [ ! -f ${VENV}/bin/activate ]; then
# only create venv if one doesn't exist
sudo -H -E python3 -m venv --system-site-packages ${VENV}
sudo -H -E chown -R ${USER} ${VENV}
fi
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.
set +u
. ${VENV}/bin/activate
set -u
VIRTUAL_ENV=${VENV}
# If we're using a venv, we need to work around sudo not
# keeping the path even with -E.
@ -119,26 +112,14 @@ EOF
export PIP_OPTS="--upgrade-strategy only-if-needed"
if [ -n "${VENV-}" ]; then
ls -la ${VENV}/bin
fi
# Install the rest of required packages using bindep
if [ -n "${VENV-}" ]; then
${PIP} install bindep
else
sudo -H -E ${PIP} install bindep
fi
${PIP} install bindep
echo "Using Bindep to install binary dependencies..."
# bindep returns 1 if packages are missing
bindep -b &> /dev/null || ${INSTALLER_CMD} $(bindep -b)
echo "Installing Python requirements"
if [ -n "${VENV-}" ]; then
${PIP} install -r "$(dirname $0)/../requirements.txt"
else
sudo -H -E ${PIP} install -r "$(dirname $0)/../requirements.txt"
fi
${PIP} install -r "$(dirname $0)/../requirements.txt"
echo "Completed installation of basic dependencies."

View File

@ -11,7 +11,6 @@ BUILD_IMAGE="${BUILD_IMAGE:-false}"
BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'}
ENABLE_KEYSTONE="${ENABLE_KEYSTONE:-false}"
ZUUL_BRANCH=${ZUUL_BRANCH:-}
ENABLE_VENV=true
CLI_TEST=${CLI_TEST:-false}
BOOT_MODE=${BOOT_MODE:-}
@ -169,7 +168,6 @@ ${ANSIBLE} -vvvv \
-e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
-e inventory_dhcp=${INVENTORY_DHCP} \
-e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \
-e enable_venv=${ENABLE_VENV} \
-e enable_inspector=${USE_INSPECTOR} \
-e inspect_nodes=${INSPECT_NODES} \
-e download_ipa=${DOWNLOAD_IPA} \

View File

@ -99,7 +99,7 @@
become: yes
- name: Install Bifrost
command: ${VENV}/bin/ansible-playbook -vvvv -i inventory/target install.yaml -e network_interface={{network_interface}} -e ansible_python_interpreter="/usr/bin/python3" -e download_ipa=true -e use_cirros=true -e enable_venv=true
command: ${VENV}/bin/ansible-playbook -vvvv -i inventory/target install.yaml -e network_interface={{network_interface}} -e ansible_python_interpreter="/usr/bin/python3" -e download_ipa=true -e use_cirros=true
environment:
PATH: "{{ansible_env.HOME}}/.local/bin:{{ansible_env.PATH}}"
VENV: "/opt/stack/bifrost"