Ian Wienand e182394e97
install-ansible: overhaul install ansible requirements
Change I4789fe99651597b073e35066ec3be312e18659b8 made me realise that
with the extant code, nothing will update the /usr/ansible-env
environment when we bump the versions.

The installation of the Ansible, openstacksdk and ARA packages as part
of the "install-ansible" role was done this way to facilitate being
able to install all three of these from their main/master/devel
branches for the "-devel" job, which is our basic canary for upstream
things that might affect us.  Because of the way the pip: role works
with "state: latest" and mixing on-disk paths with pypi package names,
this became a bit of a complex swizzling operation.

Some thing have changed since then; particularly us now using a
separate venv and upstream Ansible's change to use "collections"; so
pulling in a bug-fix for Ansible is not as simple as just cloning
github.com/ansible/ansible at a particular tag any more.  This means
we should reconsider how we're specifying the packages here.

This simplifies things to list the required packages in a
requirements.txt file, which we install into the venv root.  The nice
thing about this is that creating requirements.txt with the template:
role is idempotent, so we can essentially monitor the file for changes
and only (re-)run the pip install into /usr/ansible-env when we change
versions (forcing upgrades so we get the versions we want, and fixing
the original issue mentioned above).

Change-Id: I3696740112fa691d1700040b557f53f6721393e7
2022-12-06 13:27:46 +11:00

45 lines
1.4 KiB
ReStructuredText

Install and configure Ansible on a host via pip
This will install ansible into a virtualenv at ``/usr/ansible-venv``
**Role Variables**
.. zuul:rolevar:: install_ansible_requirements
:default: [ansible, openstacksdk]
The packages to install into the virtualenv. A list in Python
``requirements.txt`` format.
.. zuul:rolevar:: install_ansible_collections
:default: undefined
A list of Ansible collections to install. In the format
..
- namespace:
name:
repo:
.. zuul:rolevar:: install_ansible_ara_enable
:default: false
Whether or not to install the ARA Records Ansible callback plugin
into Ansible. If using the default
``install_ansible_requirements`` will install the ARA package too.
.. zuul:rolevar:: install_ansible_ara_config
A dictionary of configuration keys and their values for ARA's Ansible plugins.
Default configuration keys:
- ``api_client: offline`` (can be ``http`` for sending to remote API servers)
- ``api_server: http://127.0.0.1:8000`` (has no effect when using offline)
- ``api_username: null`` (if required, an API username)
- ``api_password: null`` (if required, an API password)
- ``api_timeout: 30`` (the timeout on http requests)
For a list of available configuration options, see the `ARA documentation`_
.. _ARA documentation: https://ara.readthedocs.io/en/latest/ara-plugin-configuration.html