diff --git a/defaults/main.yml b/defaults/main.yml index 9f7ca7e8..2baa0e74 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,8 +19,16 @@ debug: False verbose: True -# Update source -update_src: True +# These variables are used in 'developer mode' in order to allow the role +# to build an environment directly from a git source without the presence +# of an OpenStack-Ansible repo_server. +ironic_git_repo: https://git.openstack.org/openstack/ironic +ironic_git_install_branch: master +ironic_requirements_git_repo: https://git.openstack.org/openstack/requirements +ironic_requirements_git_install_branch: master +ironic_developer_mode: false +ironic_developer_constraints: + - "git+{{ ironic_git_repo }}@{{ ironic_git_install_branch }}#egg=ironic" # Name of the virtual env to deploy into ironic_venv_tag: untagged @@ -110,9 +118,10 @@ ironic_common_apt_packages: - python-pip - git -ironic_common_pip_packages: - - python-keystoneclient - - virtualenvwrapper +ironic_requires_pip_packages: + - virtualenv + - virtualenv-tools + - python-keystoneclient # Keystoneclient needed for the OSA keystone lib ironic_pip_packages: - mysql-python diff --git a/tasks/ironic_api_install.yml b/tasks/ironic_api_install.yml index 5dd81324..58a5996c 100644 --- a/tasks/ironic_api_install.yml +++ b/tasks/ironic_api_install.yml @@ -31,7 +31,7 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 diff --git a/tasks/ironic_conductor_install.yml b/tasks/ironic_conductor_install.yml index 0fc2dcb5..e495bd6a 100644 --- a/tasks/ironic_conductor_install.yml +++ b/tasks/ironic_conductor_install.yml @@ -46,7 +46,7 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 diff --git a/tasks/ironic_get_source.yml b/tasks/ironic_get_source.yml deleted file mode 100644 index 5c45a3bd..00000000 --- a/tasks/ironic_get_source.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Copyright 2014, Rackspace US, Inc. -# -# 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: git clone ironic source code - git: repo=https://github.com/openstack/ironic.git - dest={{ ironic_git_dest }} - version={{ ironic_git_install_branch }} - update={{ update_src }} - register: ironic_checkout - tags: - - ironic-api - - ironic-conductor - -- name: git clone python-ironicclient source code - git: repo=https://github.com/openstack/python-ironicclient.git - dest={{ python_ironicclient_git_dest }} - version={{ python_ironicclient_git_install_branch }} - update={{ update_src }} - register: python_ironicclient_checkout - tags: - - ironic-client diff --git a/tasks/ironic_install.yml b/tasks/ironic_install.yml index 6bdec620..17816cf8 100644 --- a/tasks/ironic_install.yml +++ b/tasks/ironic_install.yml @@ -13,13 +13,71 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Create developer mode constraint file + copy: + dest: "/opt/developer-pip-constraints.txt" + content: | + {% for item in ironic_developer_constraints %} + {{ item }} + {% endfor %} + when: + - ironic_developer_mode | bool + tags: + - ironic-install + - ironic-pip-packages + +- name: Clone requirements git repository + git: + repo: "{{ ironic_requirements_git_repo }}" + dest: "/opt/requirements" + clone: yes + update: yes + version: "{{ ironic_requirements_git_install_branch }}" + when: + - ironic_developer_mode | bool + tags: + - ironic-install + - ironic-pip-packages + +- name: Add constraints to pip_install_options fact for developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" + when: + - ironic_developer_mode | bool + tags: + - ironic-install + - ironic-pip-packages + +- name: Set pip_install_options_fact when not in developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }}" + when: + - not ironic_developer_mode | bool + tags: + - ironic-install + - ironic-pip-packages + +- name: Install requires pip packages + pip: + name: "{{ item }}" + state: present + extra_args: "{{ pip_install_options_fact }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_requires_pip_packages + tags: + - ironic-install + - ironic-pip-packages + - name: Install pip packages (venv) pip: name: "{{ item }}" state: present virtualenv: "{{ ironic_venv_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 @@ -28,6 +86,7 @@ - "{{ ironic_pip_packages }}" when: - ironic_venv_enabled | bool + - ironic_developer_mode | bool tags: - ironic-install - ironic-pip-packages @@ -36,14 +95,16 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 delay: 2 with_items: - "{{ ironic_pip_packages }}" - when: not ironic_venv_enabled | bool + when: + - not ironic_venv_enabled | bool + - not ironic_developer_mode | bool tags: - ironic-install - ironic-pip-packages diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index 5a058975..23255825 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -139,20 +139,6 @@ - ironic-install - ironic-apt-packages -- name: Install common dependencies via pip - pip: - name: "{{ item }}" - state: present - extra_args: "{{ pip_install_options|default('') }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: ironic_common_pip_packages - tags: - - ironic-install - - ironic-pip-packages - - include: ironic_messaging_setup.yml when: > inventory_hostname == groups['ironic_all'][0] diff --git a/tasks/python_ironicclient_install.yml b/tasks/python_ironicclient_install.yml index 60a2ee86..ef59857a 100644 --- a/tasks/python_ironicclient_install.yml +++ b/tasks/python_ironicclient_install.yml @@ -19,7 +19,7 @@ state: present virtualenv: "{{ ironic_venv_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 @@ -36,7 +36,7 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5