diff --git a/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml index 4226ca0ef..4c6a7fea9 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml @@ -17,21 +17,34 @@ - name: set virtualenv_command set_fact: venv_command: "{{ hostvars[inventory_hostname].ansible_python.executable }} -m virtualenv" - when: enable_venv + when: enable_venv|bool -- name: "Install {{ package }} package from pip" +- name: "Install {{ package }} package from pip using virtualenv" pip: name: "{{ package }}" state: "{{ state | default(omit) }}" version: "{{ version | default(omit) }}" - virtualenv: "{{ bifrost_venv_dir if enable_venv else omit }}" + virtualenv: "{{ bifrost_venv_dir }}" virtualenv_command: "{{ venv_command | default(omit) }}" extra_args: "{{ extra_args | default(omit) }}" register: pip_package_install_done until: pip_package_install_done|succeeded retries: 5 delay: 10 - when: source_install is not defined or source_install == false + when: (source_install is not defined or source_install == 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: "{{ extra_args | default(omit) }}" + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 + when: (source_install is not defined or source_install == false) and not enable_venv|bool + # NOTE (cinerama): We should be able to use the pip module here and # possibly merge these two tasks when # https://github.com/ansible/ansible-modules-core/pull/2600 lands.