diff --git a/playbooks/roles/bifrost-ironic-install/tasks/dib_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/dib_install.yml deleted file mode 100644 index 6718c0acb..000000000 --- a/playbooks/roles/bifrost-ironic-install/tasks/dib_install.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# 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: "DIB - Install patched library." - command: pip install --upgrade --force-reinstall "{{ dib_git_folder }}" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml index 1de9970ca..60a766dd8 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml @@ -14,12 +14,12 @@ # limitations under the License. --- - name: "Inspector - PIP Install" - pip: - name=ironic-inspector + include: pip_install.yml + package=ironic-inspector state=latest - name: "Inspector - PIP client install" - pip: - name=python-ironic-inspector-client + include: pip_install.yml + package=python-ironic-inspector-client state=latest # Note(TheJulia): Until support exists in the inspector database schema, to # allow for inspector to define its preferred database engine, MySQL cannot diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index 0e5729ac4..86850b8cb 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -44,35 +44,51 @@ with_items: - pxelinux when: ansible_distribution_version|version_compare('14.10', '>=') and ansible_distribution == 'Ubuntu' +- name: "If running in CI, set source install facts just to be sure" + set_fact: + shade_source_install: true + ironicclient_source_install: true + when: ci_testing | bool == true # 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 # here for the time being. - name: "Ensure /opt/stack is present" file: name=/opt/stack state=directory owner=root group=root - name: "proliantutils - Install from pip" - pip: name=proliantutils state=present + include: pip_install.yml + package=proliantutils + state=present when: skip_install is not defined and testing | bool != true - name: "UcsSdk - Install from pip" - pip: name=UcsSdk version=0.8.1.9 + include: pip_install.yml + package=UcsSdk + version=0.8.1.9 when: skip_install is not defined and testing | bool != true -- name: "Shade - Install from source if configured to do so" - command: pip install --upgrade --force-reinstall {{ shade_git_folder }} - when: skip_install is not defined and ((shade_source_install is defined and shade_source_install == true) or ci_testing == true) -- name: "Shade - Installing patched shade library." - pip: name=shade state=latest - when: skip_install is not defined and (shade_source_install is not defined or shade_source_install == false) and (ci_testing == false) +- name: "Shade - Install" + include: pip_install.yml + package=shade + state=latest + sourcedir={{ shade_git_folder }} + source_install={{ shade_source_install }} + when: skip_install is not defined - name: "dib-utils - install from pip" - pip: name=dib-utils state=present + include: pip_install.yml + package=dib-utils + state=present when: skip_install is not defined and create_image_via_dib == true -- name: "Ironic Client - Install from source if configured to do so." - command: pip install --upgrade --force-reinstall {{ ironicclient_git_folder }} - when: skip_install is not defined and ((ironicclient_source_install is defined and ironicclient_source_install == true) or ci_testing == true) -- name: "Ironic Client - Install from pip" - pip: name=python-ironicclient state=latest - when: skip_install is not defined and (ironicclient_source_install is not defined or ironicclient_source_install == false) and (ci_testing == false) -- name: "Include diskimage-builder installation" - include: dib_install.yml - when: create_image_via_dib == true +- name: "Diskimage-builder - Install" + include: pip_install.yml + package=diskimage-builder + sourcedir={{ dib_git_folder }} + source_install=true + when: skip_install is not defined and create_image_via_dib == true +- name: "Ironic Client - Install" + include: pip_install.yml + package=python-ironicclient + state=latest + sourcedir={{ ironicclient_git_folder }} + source_install={{ ironicclient_source_install }} + when: skip_install is not defined - name: "Start database service" service: name={{ mysql_service_name }} state=started - name: "Start rabbitmq-server" @@ -95,7 +111,11 @@ - name: "MySQL - Creating user for Ironic" mysql_user: name=ironic password='{{ ironic_db_password }}' priv=ironic.*:ALL state=present login_user="{{ mysql_username | default(None) }}" login_password="{{ mysql_password | default(None) }}" - name: "Install Ironic using pip" - pip: name={{ ironic_git_folder }} state=latest + include: pip_install.yml + package=ironic + state=latest + sourcedir={{ ironic_git_folder }} + source_install=true when: skip_install is not defined - name: "Create an ironic service group" group: name=ironic diff --git a/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml new file mode 100644 index 000000000..ecbaa8ef8 --- /dev/null +++ b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml @@ -0,0 +1,27 @@ +# Copyright (c) 2015 Hewlett Packard Enterprise Development LP. +# +# 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: "Install {{ package }} package from pip" + pip: name="{{ package }}" + state="{{ state | default(omit) }}" + version="{{ version | default(omit) }}" + virtualenv="{{ virtualenv | default(omit) }}" + when: source_install is not defined or source_install == false +# 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. +- name: "Install from {{ sourcedir }} using pip" + command: pip install --upgrade --force-reinstall {{ sourcedir }} + when: source_install is defined and (source_install | bool == true)