Merge "Add support for ansible-core"

This commit is contained in:
Zuul 2023-11-08 15:01:02 +00:00 committed by Gerrit Code Review
commit e9dd15967b
6 changed files with 47 additions and 4 deletions

View File

@ -90,11 +90,12 @@ Install dependencies for the virtual environment
pip install -U pip
#. Install `Ansible <http://www.ansible.com>`__. Kolla Ansible requires at least
Ansible ``6`` and supports up to ``7``.
Ansible ``6`` (or ansible-core ``2.14``) and supports up to ``7`` (or
ansible-core ``2.15``).
.. code-block:: console
pip install 'ansible>=6,<8'
pip install 'ansible-core>=2.14,<2.16'
Install Kolla-ansible

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds support for ansible-core only installation (use ``kolla-ansible
install-deps`` to install required collections).

11
requirements-core.yml Normal file
View File

@ -0,0 +1,11 @@
---
collections:
- name: ansible.netcommon
source: https://galaxy.ansible.com
version: <5
- name: ansible.posix
source: https://galaxy.ansible.com
version: <2
- name: community.general
source: https://galaxy.ansible.com
version: <7

View File

@ -37,6 +37,7 @@ data_files =
share/kolla-ansible = tools/init-vpn
share/kolla-ansible = setup.cfg
share/kolla-ansible = requirements.yml
share/kolla-ansible = requirements-core.yml
scripts =
tools/kolla-ansible

View File

@ -256,15 +256,34 @@
virtualenv: "{{ kolla_ansible_venv_path }}"
- name: install kolla-ansible and dependencies
vars:
ansible_core_version_min: "==2.14.*"
ansible_core_version_max: "==2.15.*"
# Test latest ansible version on Ubuntu, minimum supported on others.
ansible_core_version_constraint: >-
{{ ansible_core_version_min if is_upgrade or base_distro != 'ubuntu' else ansible_core_version_max }}
pip:
extra_args: "-c {{ upper_constraints_file }}"
name:
- "{{ kolla_ansible_src_dir }}"
- "ansible-core{{ ansible_core_version_constraint }}"
- "ansible{{ ansible_version_constraint }}"
- "ara[server]<1.7"
virtualenv: "{{ kolla_ansible_venv_path }}"
# TODO(mnasiadka): Remove in Caracal
- name: install Ansible on upgrade only
vars:
ansible_version_min: "==7.*"
ansible_version_max: "==8.*"
# Test latest ansible version on Ubuntu, minimum supported on others.
ansible_version_constraint: >-
{{ ansible_version_min if is_upgrade or base_distro != 'ubuntu' else ansible_version_max }}
pip:
extra_args: "-c {{ upper_constraints_file }}"
name: "ansible{{ ansible_version_constraint }}"
virtualenv: "{{ kolla_ansible_venv_path }}"
when: is_upgrade
- name: install Ansible collections
shell: |
source {{ kolla_ansible_venv_path }}/bin/activate

View File

@ -130,7 +130,13 @@ function find_base_dir {
function install_deps {
echo "Installing Ansible Galaxy dependencies"
ansible-galaxy collection install -r ${BASEDIR}/requirements.yml --force
if pip show ansible 2>/dev/null; then
ansible-galaxy collection install -r ${BASEDIR}/requirements.yml --force
else
ansible-galaxy collection install -r ${BASEDIR}/requirements.yml --force
ansible-galaxy collection install -r ${BASEDIR}/requirements-core.yml --force
fi
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to install Ansible Galaxy dependencies" >&2
exit 1