playbooks: Fix path when using virtual environment
When installing bifrost in a virtual environment the disk-image-create and vbmc commands are only available inside that environment so we need to set PATH appropriately similar to the bifrost-ironic-install role. Change-Id: I11c7ca5bd8c5851e5df5e1198c4bf71d5a5699e4
This commit is contained in:
parent
50b7cd4c70
commit
03cb0c663c
@ -16,3 +16,9 @@ dib_notmpfs: false
|
||||
dib_offline: false
|
||||
dib_skipbase: false
|
||||
dib_packages: ""
|
||||
# Settings related to installing bifrost in a virtual environment
|
||||
enable_venv: false
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/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
|
||||
|
@ -120,11 +120,11 @@
|
||||
dib_arglist: "{{dib_trace_arg|default('')}} {{dib_uncompressed_arg|default('')}} {{dib_clearenv_arg|default('')}} {{dib_notmpfs_arg|default('')}} {{dib_offline_arg|default('')}} {{dib_skipbase_arg|default('')}} {{dib_arch_arg|default('')}} {{dib_imagename_arg|default('')}} {{dib_imagetype_arg|default('')}} {{dib_imagesize_arg|default('')}} {{dib_imagecache_arg|default('')}} {{dib_maxresize_arg|default('')}} {{dib_mintmpfs_arg|default('')}} {{dib_mkfsopts_arg|default('')}} {{dib_qemuopts_arg|default('')}} {{dib_rootlabel_arg|default('')}} {{dib_rdelement_arg|default('')}} {{dib_installtype_arg|default('')}} {{dib_packages_arg|default('')}} {{dib_os_element}} {{dib_elements|default('')}}"
|
||||
- name: "Initiate image build"
|
||||
command: disk-image-create {{dib_arglist}}
|
||||
environment: "{{ dib_env_vars_final }}"
|
||||
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else '{}') }}"
|
||||
when: build_ramdisk | bool == false and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false
|
||||
- name: "Initiate ramdisk build"
|
||||
command: ramdisk-image-create {{dib_arglist}}
|
||||
environment: "{{ dib_env_vars_final }}"
|
||||
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else '{}') }}"
|
||||
when: build_ramdisk | bool == true and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false
|
||||
- name: "Update permission of generated image"
|
||||
file:
|
||||
|
@ -32,3 +32,9 @@ test_vm_emulator: "/usr/bin/qemu-system-x86_64"
|
||||
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: false
|
||||
bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/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
|
||||
|
@ -98,10 +98,12 @@
|
||||
- name: get list of nodes from virtualbmc
|
||||
command: vbmc list
|
||||
register: vbmc_list
|
||||
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
|
||||
|
||||
# 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 '{}' }}"
|
||||
when: vbmc_list.stdout.find("{{ vm_name }} ") != -1
|
||||
|
||||
- set_fact:
|
||||
@ -109,9 +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 '{}' }}"
|
||||
|
||||
- name: start virtualbmc
|
||||
command: vbmc start {{ vm_name }}
|
||||
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
|
||||
|
||||
- name: get XML of the vm
|
||||
virt:
|
||||
|
Loading…
Reference in New Issue
Block a user