diff --git a/bifrost/cli.py b/bifrost/cli.py index a9502ff64..7cec91330 100644 --- a/bifrost/cli.py +++ b/bifrost/cli.py @@ -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]), '..')) diff --git a/doc/source/install/index.rst b/doc/source/install/index.rst index bd289670f..8a6c57474 100644 --- a/doc/source/install/index.rst +++ b/doc/source/install/index.rst @@ -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 ========================= diff --git a/playbooks/ci/run.yaml b/playbooks/ci/run.yaml index ab64b7655..565603093 100644 --- a/playbooks/ci/run.yaml +++ b/playbooks/ci/run.yaml @@ -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') }}" diff --git a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml index 4d6b4f56f..fbc538244 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml b/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml index 065f3562e..462606bf4 100644 --- a/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml +++ b/playbooks/roles/bifrost-create-bootable-image/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-create-dib-image/defaults/main.yml b/playbooks/roles/bifrost-create-dib-image/defaults/main.yml index d34ea211c..944ad4f73 100644 --- a/playbooks/roles/bifrost-create-dib-image/defaults/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml index 8465bbd78..ae8ce60a3 100644 --- a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index 1ba484b36..356b78015 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -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" diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/create_vm.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/create_vm.yml index 62373b3df..b8d4b3f41 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/create_vm.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/create_vm.yml @@ -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: diff --git a/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.service.j2 b/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.service.j2 index 0877ff038..7b9aade6c 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.service.j2 +++ b/playbooks/roles/bifrost-create-vm-nodes/templates/redfish-emulator.service.j2 @@ -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 diff --git a/playbooks/roles/bifrost-create-vm-nodes/templates/vbmcd.service.j2 b/playbooks/roles/bifrost-create-vm-nodes/templates/vbmcd.service.j2 index 147945c54..ce498c28a 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/templates/vbmcd.service.j2 +++ b/playbooks/roles/bifrost-create-vm-nodes/templates/vbmcd.service.j2 @@ -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 diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml index 2af21fc51..1dd160701 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-ironic-install/README.md b/playbooks/roles/bifrost-ironic-install/README.md index ca7bad8f4..f05e147b2 100644 --- a/playbooks/roles/bifrost-ironic-install/README.md +++ b/playbooks/roles/bifrost-ironic-install/README.md @@ -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 diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index c17abb339..82cf11e26 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index d05c57d04..006960ede 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -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: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml index c44f73125..3668a3363 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml @@ -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 diff --git a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml index fe3fc5303..cace7b3d8 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml @@ -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" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml index 38454a04f..024ab3ff0 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup.yml @@ -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 diff --git a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml index 807887316..5ec4e9687 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/keystone_setup_inspector.yml @@ -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 diff --git a/playbooks/roles/bifrost-ironic-install/tasks/migrations.yml b/playbooks/roles/bifrost-ironic-install/tasks/migrations.yml index 05f194339..c161374ce 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/migrations.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/migrations.yml @@ -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' diff --git a/playbooks/roles/bifrost-ironic-install/tasks/validate.yml b/playbooks/roles/bifrost-ironic-install/tasks/validate.yml index eb6576e1c..2e9ef0c0d 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/validate.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/validate.yml @@ -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 diff --git a/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml b/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml index 211b37e4e..4b13de8a3 100644 --- a/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml +++ b/playbooks/roles/bifrost-keystone-client-config/defaults/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-keystone-install/defaults/main.yml b/playbooks/roles/bifrost-keystone-install/defaults/main.yml index e0bd98760..296d24f8d 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/main.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/main.yml @@ -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" diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index d3e4f5225..01a5edb93 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -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 diff --git a/playbooks/roles/bifrost-keystone-install/tasks/main.yml b/playbooks/roles/bifrost-keystone-install/tasks/main.yml index 1b02abb31..b747715db 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/main.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/main.yml @@ -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: diff --git a/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 b/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 index b722911fc..65832636d 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/keystone-admin.ini.j2 @@ -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 diff --git a/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 b/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 index 12ea3b6ac..559aa6676 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/keystone-public.ini.j2 @@ -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 diff --git a/playbooks/roles/bifrost-pip-install/defaults/main.yml b/playbooks/roles/bifrost-pip-install/defaults/main.yml index 019db9e14..7f1d21a11 100644 --- a/playbooks/roles/bifrost-pip-install/defaults/main.yml +++ b/playbooks/roles/bifrost-pip-install/defaults/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-pip-install/tasks/main.yml b/playbooks/roles/bifrost-pip-install/tasks/main.yml index 5a13bbf84..c353dc0bd 100644 --- a/playbooks/roles/bifrost-pip-install/tasks/main.yml +++ b/playbooks/roles/bifrost-pip-install/tasks/main.yml @@ -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 diff --git a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml index 97fb3315e..839243344 100644 --- a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml b/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml index 9e35436d7..3b827daad 100644 --- a/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-rabbitmq/defaults/main.yml b/playbooks/roles/bifrost-rabbitmq/defaults/main.yml index f6e870e54..a5c5dfcb1 100644 --- a/playbooks/roles/bifrost-rabbitmq/defaults/main.yml +++ b/playbooks/roles/bifrost-rabbitmq/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/bifrost-unprovision-node-dynamic/defaults/main.yml b/playbooks/roles/bifrost-unprovision-node-dynamic/defaults/main.yml index fccc92815..dab4cb995 100644 --- a/playbooks/roles/bifrost-unprovision-node-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-unprovision-node-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/ironic-delete-dynamic/defaults/main.yml b/playbooks/roles/ironic-delete-dynamic/defaults/main.yml index b418c84d6..9f8a89af3 100644 --- a/playbooks/roles/ironic-delete-dynamic/defaults/main.yml +++ b/playbooks/roles/ironic-delete-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml index 28dfcf06e..39d68e3cc 100644 --- a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml +++ b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml @@ -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' }}" diff --git a/playbooks/roles/ironic-inspect-node/defaults/main.yml b/playbooks/roles/ironic-inspect-node/defaults/main.yml index 8ef1fadbe..31c164be7 100644 --- a/playbooks/roles/ironic-inspect-node/defaults/main.yml +++ b/playbooks/roles/ironic-inspect-node/defaults/main.yml @@ -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' }}" diff --git a/releasenotes/notes/venv-forever-ba8b85b04a28a293.yaml b/releasenotes/notes/venv-forever-ba8b85b04a28a293.yaml new file mode 100644 index 000000000..ae72c6e24 --- /dev/null +++ b/releasenotes/notes/venv-forever-ba8b85b04a28a293.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + No longer supports installation outside of a virtual environment. The + parameter ``enable_venv`` has been removed. diff --git a/scripts/env-setup.sh b/scripts/env-setup.sh index af2f7160c..515dcfc46 100755 --- a/scripts/env-setup.sh +++ b/scripts/env-setup.sh @@ -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 diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index cdfa94a8b..1041c6d88 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -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." diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index c7dab22ad..3f9fec6d1 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -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} \ diff --git a/tools/vagrant_dev_env/vagrant.yml b/tools/vagrant_dev_env/vagrant.yml index e8a19e922..b50057231 100644 --- a/tools/vagrant_dev_env/vagrant.yml +++ b/tools/vagrant_dev_env/vagrant.yml @@ -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"