Merge "Get rid of venv_python_path"

This commit is contained in:
Zuul 2020-06-26 06:57:36 +00:00 committed by Gerrit Code Review
commit 810b5b3001
8 changed files with 14 additions and 85 deletions

View File

@ -13,13 +13,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- import_role:
name: venv_python_path
- name: Ensure required packages are installed - name: Ensure required packages are installed
package: package:
name: "{{ dib_host_required_packages }}" name: "{{ dib_host_required_packages }}"
state: present state: present
environment: "{{ venv }}"
# If attempting to utilize a base Ubuntu image, diskimage-builder # If attempting to utilize a base Ubuntu image, diskimage-builder
# is the recommended, and default path. # is the recommended, and default path.
- name: "Test if image is present" - name: "Test if image is present"

View File

@ -15,9 +15,6 @@
--- ---
# This is overly complex, however get_url will always re-retrieve the file # This is overly complex, however get_url will always re-retrieve the file
# if it already exists, and this is to prevent that behavior. # if it already exists, and this is to prevent that behavior.
- import_role:
name: venv_python_path
- name: "Test if IPA kernel is present" - name: "Test if IPA kernel is present"
stat: path={{ ipa_kernel }} stat: path={{ ipa_kernel }}
register: test_ipa_kernel_present register: test_ipa_kernel_present
@ -27,7 +24,6 @@
get_url: url="{{ ipa_kernel_upstream_checksum_url }}" dest="{{ ipa_kernel }}.{{ ipa_kernel_upstream_checksum_algo }}" timeout=300 get_url: url="{{ ipa_kernel_upstream_checksum_url }}" dest="{{ ipa_kernel }}.{{ ipa_kernel_upstream_checksum_algo }}" timeout=300
register: ipa_kernel_checksum_result register: ipa_kernel_checksum_result
ignore_errors: yes ignore_errors: yes
environment: "{{ venv }}"
- debug: msg="WARNING!!! {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }}" - debug: msg="WARNING!!! {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }}"
when: ipa_kernel_checksum_result is defined and ipa_kernel_checksum_result.status_code is defined and ipa_kernel_checksum_result.status_code == 404 when: ipa_kernel_checksum_result is defined and ipa_kernel_checksum_result.status_code is defined and ipa_kernel_checksum_result.status_code == 404
- fail: msg="FATAL {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }} GOT {{ ipa_kernel_checksum_result }}" - fail: msg="FATAL {{ ipa_kernel_upstream_checksum_algo }} file not found at {{ ipa_kernel_upstream_checksum_url }} GOT {{ ipa_kernel_checksum_result }}"
@ -58,7 +54,6 @@
(ipa_kernel_download_done is failed) (ipa_kernel_download_done is failed)
retries: 5 retries: 5
delay: 10 delay: 10
environment: "{{ venv }}"
when: update_ipa | bool or test_ipa_kernel_present.stat.exists == false when: update_ipa | bool or test_ipa_kernel_present.stat.exists == false
- name: "Test if IPA image is present" - name: "Test if IPA image is present"
@ -70,7 +65,6 @@
get_url: url="{{ ipa_ramdisk_upstream_checksum_url }}" dest="{{ ipa_ramdisk }}.{{ ipa_ramdisk_upstream_checksum_algo }}" timeout=300 get_url: url="{{ ipa_ramdisk_upstream_checksum_url }}" dest="{{ ipa_ramdisk }}.{{ ipa_ramdisk_upstream_checksum_algo }}" timeout=300
register: ipa_ramdisk_checksum_result register: ipa_ramdisk_checksum_result
ignore_errors: yes ignore_errors: yes
environment: "{{ venv }}"
- debug: msg="WARNING!!! {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}" - debug: msg="WARNING!!! {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}"
when: ipa_ramdisk_checksum_result is defined and ipa_ramdisk_checksum_result.status_code is defined and ipa_ramdisk_checksum_result.status_code == 404 when: ipa_ramdisk_checksum_result is defined and ipa_ramdisk_checksum_result.status_code is defined and ipa_ramdisk_checksum_result.status_code == 404
- fail: msg="FATAL {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}" - fail: msg="FATAL {{ ipa_ramdisk_upstream_checksum_algo }} file not found at {{ ipa_ramdisk_upstream_checksum_url }}"
@ -101,5 +95,4 @@
(ipa_ramdisk_download_done is failed and ipa_ramdisk_download_done.status_code is defined and ipa_ramdisk_download_done.status_code == 404) (ipa_ramdisk_download_done is failed and ipa_ramdisk_download_done.status_code is defined and ipa_ramdisk_download_done.status_code == 404)
retries: 5 retries: 5
delay: 10 delay: 10
environment: "{{ venv }}"
when: update_ipa | bool or test_ipa_image_present.stat.exists == false when: update_ipa | bool or test_ipa_image_present.stat.exists == false

View File

@ -13,9 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- import_role:
name: venv_python_path
- name: Create {{ ipxe_dir }} - name: Create {{ ipxe_dir }}
file: file:
name={{ ipxe_dir }} name={{ ipxe_dir }}
@ -36,7 +33,6 @@
loop: loop:
- undionly.kpxe - undionly.kpxe
- ipxe.pxe - ipxe.pxe
environment: "{{ venv }}"
- name: Get iPXE EFI binary - name: Get iPXE EFI binary
get_url: get_url:
@ -49,5 +45,4 @@
delay: 10 delay: 10
loop: loop:
- "{{ ipxe_efi_binary }}" - "{{ ipxe_efi_binary }}"
environment: "{{ venv }}"
when: enable_uefi_ipxe | bool == true when: enable_uefi_ipxe | bool == true

View File

@ -13,9 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- import_role:
name: venv_python_path
- name: "Update Package Cache" - name: "Update Package Cache"
apt: update_cache=yes apt: update_cache=yes
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'

View File

@ -16,11 +16,6 @@
# We should likely address that at some point, however I think a user # We should likely address that at some point, however I think a user
# should be the driver of that work. # should be the driver of that work.
- name: "Initialize default venv"
set_fact:
venv:
OS_IDENTITY_API_VERSION: "3"
- name: "Error if credentials are undefined." - name: "Error if credentials are undefined."
fail: fail:
msg: | msg: |
@ -39,9 +34,6 @@
ironic.keystone.default_username is undefined or ironic.keystone.default_username is undefined or
ironic.keystone.default_password is undefined ironic.keystone.default_password is undefined
- import_role:
name: venv_python_path
- name: "Ensure service project is present" - name: "Ensure service project is present"
os_project: os_project:
name: "{{ ironic.service_catalog.project_name }}" name: "{{ ironic.service_catalog.project_name }}"
@ -56,7 +48,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}" project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create service user for ironic" - name: "Create service user for ironic"
@ -74,7 +66,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Associate ironic user to admin role" - name: "Associate ironic user to admin role"
@ -90,7 +82,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create keystone service record for ironic" - name: "Create keystone service record for ironic"
@ -107,7 +99,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Check ironic admin endpoint exists" - name: "Check ironic admin endpoint exists"
@ -218,7 +210,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}" project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create baremetal_observer role" - name: "Create baremetal_observer role"
@ -232,7 +224,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}" project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create baremetal project" - name: "Create baremetal project"
@ -249,7 +241,7 @@
project_name: "{{ keystone.bootstrap.project_name | default('admin') }}" project_name: "{{ keystone.bootstrap.project_name | default('admin') }}"
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create bifrost user" - name: "Create bifrost user"
@ -266,7 +258,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Associate bifrost user with baremetal_admin" - name: "Associate bifrost user with baremetal_admin"
@ -282,5 +274,5 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true

View File

@ -16,11 +16,6 @@
# We should likely address that at some point, however I think a user # We should likely address that at some point, however I think a user
# should be the driver of that work. # should be the driver of that work.
- name: "Initialize default venv"
set_fact:
venv:
OS_IDENTITY_API_VERSION: "3"
- name: "Error if credentials are undefined." - name: "Error if credentials are undefined."
fail: fail:
msg: | msg: |
@ -38,9 +33,6 @@
ironic_inspector.keystone.default_username is undefined or ironic_inspector.keystone.default_username is undefined or
ironic_inspector.keystone.default_password is undefined ironic_inspector.keystone.default_password is undefined
- import_role:
name: venv_python_path
- name: "Create service user for ironic-inspector" - name: "Create service user for ironic-inspector"
os_user: os_user:
name: "{{ ironic_inspector.service_catalog.username }}" name: "{{ ironic_inspector.service_catalog.username }}"
@ -56,7 +48,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Associate ironic_inspector user to admin role" - name: "Associate ironic_inspector user to admin role"
@ -72,7 +64,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Create keystone service record for ironic-inspector" - name: "Create keystone service record for ironic-inspector"
@ -89,7 +81,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Check ironic-inspector admin endpoint exists" - name: "Check ironic-inspector admin endpoint exists"
@ -203,7 +195,7 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true
- name: "Associate inspector_user with baremetal_admin" - name: "Associate inspector_user with baremetal_admin"
@ -219,5 +211,5 @@
project_domain_id: "default" project_domain_id: "default"
user_domain_id: "default" user_domain_id: "default"
wait: yes wait: yes
environment: "{{ venv }}" environment: "{{ bifrost_venv_env if enable_venv else {} }}"
no_log: true no_log: true

View File

@ -11,14 +11,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- import_role:
name: venv_python_path
- name: "Install packages" - name: "Install packages"
package: package:
name: "{{ required_packages }}" name: "{{ required_packages }}"
state: present state: present
environment: "{{ venv }}"
# NOTE(TheJulia) While we don't necessarilly require /opt/stack any longer # NOTE(TheJulia) While we don't necessarilly require /opt/stack any longer
# and it should already be created by the Ansible setup, we will leave this # and it should already be created by the Ansible setup, we will leave this

View File

@ -1,33 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# 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: "Retrieve venv python3 path"
shell: "/bin/echo -e \"import sys\\nprint(':'.join(sys.path))\" | {{ ansible_python.get('executable', '/usr/bin/python3').split('/')[-1] }}"
environment: "{{ bifrost_venv_env | default({}) }}"
register: venv_pythonpath_result
when: enable_venv
- name: "Compute venv python path"
set_fact:
venv_pythonpath:
PYTHONPATH: "{{ venv_pythonpath_result.get('stdout', '') }}"
when: enable_venv
- name: "Compute proper complete venv including proper Python path"
set_fact:
venv: "{{ venv | default({}) | combine(bifrost_venv_env | default({})) | combine(venv_pythonpath | default({})) }}"