bifrost/playbooks/roles/bifrost-prep-for-install
Pavlo Shchelokovskyy 7a7f858ae2 Always install Ansible with pip
Instaling and using Ansible from source for bifrost has several
drawbacks, mainly due to how Ansible's 'ansible/hacking/env-setup'
script mangles with PATH and PYTHONPATH, which complicates running it as
part of other scripts. Besides, cloning the whole repo and it's
submodules is somewhat longer.

The main reason why we were doing that at all was a necessity to install
some additional Ansible modules from newer Ansible versions, which we
dropped right into the source of Ansible code - but this does not have to
be so.

Luckily for us, all Ansible versions we target to support can load
modules from 'library' directory next to playbooks/roles,
and we already use that for 'os_ironic_facts' module.
The need to install a particular module can be assessed by running
ad-hoc 'ansible' command against localhost with the module in question
and without any arguments ('ansible localhost -m <module>'):
- if the module is available in Ansible, the stderr will contain
  "changed" substring (as part of the standard module output)
- if the module is absent form Ansible, "changed" string will be absent
  from stderr too, in which case we can download the module from github
  directly into 'playbooks/library' directory.

This patch removes possibility of installing Ansible from source, and
always installs a released Ansible version via pip.
If not installed into venv, Ansible will be installed in user's ~/.local
directory via 'pip install --user'.
The missing but needed modules are downloaded as described above.

Some level of backward compatibility is provided:
- when the ANSIBLE_GIT_BRANCH has form of 'stable-X.Y', the
  env-setup.sh script will do the next best thing and install latest
  available Ansible version of X.Y.w.z

Also, ANSIBLE_PIP_VERSION can now accept a full pip version specifier:
- if ANSIBLE_PIP_VERSION starts with a digit, this exact version will be
  installed (as 'ansible==X.Y.W.Z')
- otherwize this whole variable is assigned as Ansible version specifier
  for pip, e.g

    env ANSIBLE_PIP_VERSION="<2.2" env-setup.sh

  will result in pip being called as

    pip install -U "ansible<2.2"

Closes-Bug: #1663562
Change-Id: I2c9f47abbbb6740d03978f684ad2c876749655b7
2017-02-13 13:10:54 +02:00
..
defaults Add keystone to git contents download 2017-01-13 15:37:15 +00:00
meta Cleanup role meta definitions 2015-08-25 19:41:29 -04:00
tasks Always install Ansible with pip 2017-02-13 13:10:54 +02:00
README.md Typo fix: prepatory => preparatory 2017-02-06 11:41:27 +07:00

README.md

bifrost-prep-for-install

This role performs the initial file downloads to allow a user to install bifrost. It does not require internet access, as new URLs or local filesystem clones of repositories can be defined.

Requirements

This role requires:

  • Ansible 1.9

Internet access was originally a requirement for installation, however access is no longer required. See doc/source/offline-install.rst for details on installing without it.

Role Variables

git_root: The base location for cloned git repositories. This defaults to "/opt/stack".

ironicclient_git_url: URL for ironicclient, defaults to: https://git.openstack.org/openstack/python-ironicclient

shade_git_url: URL for shade, defaults to: https://git.openstack.org/openstack-infra/shade

ironic_git_url: URL for ironic, defaults to: https://git.openstack.org/openstack/ironic

ironicclient_git_folder: The folder to clone ironicclient to if missing, defaults to: "{{ git_root}}/ironicclient.git"

ironic_git_folder: The folder to clone ironic to if missing, default to: "{{ git_root}}/ironic.git"

shade_git_folder: The folder to clone shade to if missing, defaults to: "{{ git_root}}/shade.git"

ironicclient_git_branch: Branch to install, defaults to "master".

ironic_git_branch: Branch to install, defaults to "master".

shade_git_branch: Branch to install, defaults to "master".

copy_from_local_path: Boolean value, defaults to false. If set to true, the role will attempt to perform a filesystem copy of locally defined git repositories instead of cloning the local repositories in order to preserve the pre-existing repository state. This is largely something that is needed in CI testing if dependent changes are pre-staged in the local repositories.

ci_testing_zuul: Boolean value, default false. This value is utilized to tell the preparatory playbook when the prep role is running in a CI system with Zuul, which in such cases the repositories must be copied, not overwritten. Dependencies

None at this time.

Example Playbook

  • hosts: localhost connection: local name: "Install Ironic" become: yes gather_facts: yes roles:
    • { role: bifrost-prep-for-install, when: skip_install is not defined }
    • role: bifrost-ironic-install cleaning: false testing: true

License

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.

Author Information

Ironic Developers