Streamline pip installs

We currently have a bunch of plays to install python
packages either from PyPi or source checkouts. Create
a parameterized include playbook to streamline the main
install role playbook. Also get rid of dib_install.yml
since we can use this new playbook instead.

Change-Id: I33bd94bcfc7577ee863af4cd480b096096ab2472
This commit is contained in:
stephane 2015-12-17 10:16:40 -08:00
parent affd2eebf4
commit d4a560937c
4 changed files with 70 additions and 40 deletions

View File

@ -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 }}"

View File

@ -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

View File

@ -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

View File

@ -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)