Install mysql client libraries

Adjutant uses mysqlclient python module to connect to
mysql. It requires mysql libraries to be present both during wheel build
and while usage. So mysqlclient libraries should be present at any time.

We also move adjutant pip package from a constraint to a requirement as part
of new pip resolver task

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-galera_server/+/791045
Change-Id: I56ec209d0e80339cfa275a15bc8c3ff0891b5eae
This commit is contained in:
Dmitriy Rabotyagov 2021-02-25 17:37:51 +02:00
parent 69aa68921d
commit a281b811c6
5 changed files with 72 additions and 16 deletions

View File

@ -35,7 +35,6 @@ adjutant_git_repo: https://opendev.org/openstack/adjutant
adjutant_git_install_branch: master
adjutant_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
adjutant_git_constraints:
- "git+{{ adjutant_git_repo }}@{{ adjutant_git_install_branch }}#egg=adjutant"
- "--constraint {{ adjutant_upper_constraints_url }}"
adjutant_user_domain_name: Default
@ -255,6 +254,9 @@ adjutant_pip_install_args: "{{ pip_install_options | default('') }}"
adjutant_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}"
adjutant_pip_packages:
- python-adjutant
- "git+{{ adjutant_git_repo }}@{{ adjutant_git_install_branch }}#egg=python-adjutant"
- cryptography
- systemd-python
adjutant_pip_extra_packages:
- mysqlclient

View File

@ -0,0 +1,59 @@
---
# Copyright 2021, City Network International AB
#
# 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.
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_python_executable: "{{ adjutant_venv_python_executable }}"
venv_build_constraints: "{{ adjutant_git_constraints }}"
venv_build_distro_package_list: "{{ adjutant_devel_distro_packages }}"
venv_install_destination_path: "{{ adjutant_bin | dirname }}"
venv_pip_install_args: "{{ adjutant_pip_install_args }}"
venv_pip_packages: "{{ adjutant_pip_packages }}"
venv_facts_when_changed:
- section: "adjutant"
option: "venv_tag"
value: "{{ adjutant_venv_tag }}"
tags:
- adjutant-install
# NOTE(noonedeadpunk): We perform all these tasks as mysqlclient library requires
# mysql-dev to be installed both during wheels build and runtime (wheel installation).
# To reduce places where we need mysql-devel, we install mysqlclient separately inside
# venv on the adjutant containers directly.
- name: Install maria devel packages
import_role:
name: galera_server
vars:
galera_install_devel: true
- name: Install distro packages for extra package build
package:
name: "{{ adjutant_distro_packages }}"
state: "{{ adjutant_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: _install_distro_packages
until: _install_distro_packages is success
retries: 5
delay: 2
- name: Install extra pip packages into build venv
pip:
virtualenv: "{{ adjutant_bin | dirname }}"
name: "{{ adjutant_pip_extra_packages }}"
state: present
extra_args: "{{ (adjutant_git_constraints + [adjutant_pip_install_args]) | join(' ') }}"

View File

@ -47,20 +47,7 @@
tags:
- adjutant-install
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_python_executable: "{{ adjutant_venv_python_executable }}"
venv_build_constraints: "{{ adjutant_git_constraints }}"
venv_build_distro_package_list: "{{ adjutant_devel_distro_packages }}"
venv_install_destination_path: "{{ adjutant_bin | dirname }}"
venv_pip_install_args: "{{ adjutant_pip_install_args }}"
venv_pip_packages: "{{ adjutant_pip_packages }}"
venv_facts_when_changed:
- section: "adjutant"
option: "venv_tag"
value: "{{ adjutant_venv_tag }}"
- import_tasks: adjutant_install.yml
tags:
- adjutant-install

View File

@ -16,6 +16,10 @@
## APT Cache options
cache_timeout: 600
adjutant_distro_packages:
- python3-dev
- g++
adjutant_devel_distro_packages:
- cmake
- gcc

View File

@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
adjutant_distro_packages:
- python3-devel
- gcc
adjutant_devel_distro_packages:
- git-core
- openssl-devel