Merge "CI: Move openstack clients setup to a role"
This commit is contained in:
commit
7fc76fb4e9
18
roles/openstack-clients/README.rst
Normal file
18
roles/openstack-clients/README.rst
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Install openstack clients required for Kolla-Ansible CI scripts.
|
||||||
|
The defaults are suitable for CI environment.
|
||||||
|
|
||||||
|
**Role Variables**
|
||||||
|
|
||||||
|
.. zuul:rolevar:: openstack_clients_pip_packages
|
||||||
|
|
||||||
|
List of dictionaries, with package and enabled keys, e.g.:
|
||||||
|
- package: python-barbicanclient
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
.. zuul:rolevar:: openstack_clients_venv_base
|
||||||
|
|
||||||
|
Directory used as base for python venv
|
||||||
|
|
||||||
|
.. zuul:rolevar:: openstack_clients_venv_name
|
||||||
|
|
||||||
|
Name of python venv to use for package installations
|
32
roles/openstack-clients/defaults/main.yml
Normal file
32
roles/openstack-clients/defaults/main.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
openstack_clients_pip_packages:
|
||||||
|
- package: python-barbicanclient
|
||||||
|
enabled: "{{ scenario == 'scenario_nfv' }}"
|
||||||
|
- package: python-designateclient
|
||||||
|
enabled: "{{ scenario == 'magnum' }}"
|
||||||
|
- package: python-heatclient
|
||||||
|
enabled: true
|
||||||
|
- package: python-ironicclient
|
||||||
|
enabled: "{{ scenario == 'ironic' }}"
|
||||||
|
- package: python-ironic-inspector-client
|
||||||
|
enabled: "{{ scenario == 'ironic' }}"
|
||||||
|
- package: python-magnumclient
|
||||||
|
enabled: "{{ scenario == 'magnum' }}"
|
||||||
|
- package: python-masakariclient
|
||||||
|
enabled: "{{ scenario == 'masakari' }}"
|
||||||
|
- package: python-mistralclient
|
||||||
|
enabled: "{{ scenario == 'scenario_nfv' }}"
|
||||||
|
- package: python-octaviaclient
|
||||||
|
enabled: "{{ scenario in ['octavia', 'ovn'] }}"
|
||||||
|
- package: python-openstackclient
|
||||||
|
enabled: true
|
||||||
|
- package: python-tackerclient
|
||||||
|
enabled: "{{ scenario == 'scenario_nfv' }}"
|
||||||
|
- package: python-troveclient
|
||||||
|
enabled: "{{ scenario == 'magnum' }}"
|
||||||
|
- package: python-zunclient
|
||||||
|
enabled: "{{ scenario == 'zun' }}"
|
||||||
|
|
||||||
|
openstack_clients_venv_base: "{{ ansible_user_dir }}"
|
||||||
|
openstack_clients_venv_name: "openstackclient-venv"
|
||||||
|
openstack_clients_venv_path: "{{ openstack_clients_venv_base }}/{{ openstack_clients_venv_name }}"
|
9
roles/openstack-clients/tasks/main.yml
Normal file
9
roles/openstack-clients/tasks/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Setup OpenStack clients
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name: "{{ item.package }}"
|
||||||
|
virtualenv: "{{ openstack_clients_venv_path }}"
|
||||||
|
virtualenv_command: "python3 -m venv"
|
||||||
|
become: true
|
||||||
|
when: item.enabled
|
||||||
|
loop: "{{ openstack_clients_pip_packages }}"
|
@ -334,6 +334,10 @@
|
|||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
|
- name: Ensure OpenStack clients are installed
|
||||||
|
import_role:
|
||||||
|
name: openstack-clients
|
||||||
|
|
||||||
# NOTE(mgoddard): We are using the script module here and later to ensure
|
# NOTE(mgoddard): We are using the script module here and later to ensure
|
||||||
# we use the local copy of these scripts, rather than the one on the remote
|
# we use the local copy of these scripts, rather than the one on the remote
|
||||||
# host, which could be checked out to a previous release (in an upgrade
|
# host, which could be checked out to a previous release (in an upgrade
|
||||||
|
@ -7,39 +7,6 @@ set -o pipefail
|
|||||||
# Enable unbuffered output for Ansible in Jenkins.
|
# Enable unbuffered output for Ansible in Jenkins.
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
|
||||||
function setup_openstack_clients {
|
|
||||||
# Prepare virtualenv for openstack deployment tests
|
|
||||||
local packages=(python-openstackclient python-heatclient)
|
|
||||||
if [[ $SCENARIO == zun ]]; then
|
|
||||||
packages+=(python-zunclient)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == ironic ]]; then
|
|
||||||
packages+=(python-ironicclient python-ironic-inspector-client)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == magnum ]]; then
|
|
||||||
packages+=(python-designateclient python-magnumclient python-troveclient)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == octavia ]]; then
|
|
||||||
packages+=(python-octaviaclient)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == masakari ]]; then
|
|
||||||
packages+=(python-masakariclient)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == scenario_nfv ]]; then
|
|
||||||
packages+=(python-tackerclient python-barbicanclient python-mistralclient)
|
|
||||||
fi
|
|
||||||
if [[ $SCENARIO == ovn ]]; then
|
|
||||||
packages+=(python-octaviaclient)
|
|
||||||
fi
|
|
||||||
if [[ "debian" == $BASE_DISTRO ]]; then
|
|
||||||
sudo apt -y install python3-venv
|
|
||||||
fi
|
|
||||||
python3 -m venv ~/openstackclient-venv
|
|
||||||
~/openstackclient-venv/bin/pip install -U pip
|
|
||||||
~/openstackclient-venv/bin/pip install -c $UPPER_CONSTRAINTS ${packages[@]}
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare_images {
|
function prepare_images {
|
||||||
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
||||||
return
|
return
|
||||||
@ -146,8 +113,6 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setup_openstack_clients
|
|
||||||
|
|
||||||
RAW_INVENTORY=/etc/kolla/inventory
|
RAW_INVENTORY=/etc/kolla/inventory
|
||||||
|
|
||||||
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
|
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
|
||||||
|
Loading…
Reference in New Issue
Block a user