bifrost/releasenotes/notes/ansible-pip-install-2b66bd82ce9ed4f6.yaml
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

57 lines
2.2 KiB
YAML

---
features:
- |
Bifrost now prefers to use a system with Ansible already installed.
When this is the case, execution of the ``env-setup.sh`` script is not
required as it is geared for development and testing use of bifrost.
In order to use the playbooks on a system with Ansible already installed,
the library requirements must be installed prior to playbook
execution:
``pip install -r requirements.txt``
Administrative privileges may be required if the packages
must be installed system wide.
- |
The environment setup script will now attempt to install bifrost from PyPI
instead of using a stable branch. This is to address stability issues
with Ansible stable branches.
If not requested to be installed into virtualenv, Ansible will be installed
into user's ``~/.local`` directory to not clobber possibly existing
system installation.
To use such installed Ansible, modifications of ``$PATH``
environment variable might be required to include ``~/.local/bin`` path.
Some backwards compatibility is provided via the use of the
``ANSIBLE_GIT_BRANCH`` variable, where a user can define ``stable-X.Y``
and the latest available version in that series will be installed.
To install the Ansible 2.1 series as part of the env-setup script,
execute ``env ANSIBLE_GIT_BRANCH="stable-2.1" scripts/env-setup``.
Similarly, ``ANSIBLE_PIP_VERSION`` can be utilized to specify
the exact version, or range of version desired. Example:
``ANSIBLE_PIP_VERSION=2.1.0.1`` or ``ANSIBLE_PIP_VERSION=<2.2``
issues:
- |
If installing bifrost in a virtualenv (venv) and running playbooks
against localhost, you must install the basic python requirements
on a system-wide level due to the operating behavior of Ansible.
fixes:
- |
Due to breaking change in the stable branch tags utilized with Ansible,
bifrost now utilizes installation of Ansible from PyPI.
deprecations:
- |
The ``ANSIBLE_INSTALL_ROOT`` variable has been deprecated and is used
only to raise a warning for third party scripts.
- |
The ``ANSIBLE_FROM_PYPI`` variable no longer has any effect, as Ansible
is always installed from PyPI now.