kayobe/ansible/kolla-target-venv.yml
Pierre Riteau 74eff837cb CI: Fix multiple failures
Tox jobs are timing out in CI due to pip dependency resolution
backtracking taking too long. When run locally, pip fails to resolve
dependencies due to upper-constraints now allowing pluggy 1.0.0 [1],
while molecule still depends on pluggy >= 0.7.1, < 1.0. See similar
tripleo bug for more details [2].

Split molecule dependencies in a separate requirements file and remove
upper constraints from its tox environment for now. As a bonus, it
should speed up execution of the jobs due to installing fewer
dependencies.

Stop using upper-constraints when installing docker python library [3].
This part of the commit can be reverted when docker 5.0.2 is in upper
constraints.

Update Kolla inventory template following renaming of haproxy role to
loadbalancer [4]. With the existing template, haproxy/keepalived
containers are not created and service deployment fails while trying to
connect to MySQL using the VIP.

[1] https://review.opendev.org/c/openstack/requirements/+/806680
[2] https://bugs.launchpad.net/tripleo/+bug/1942508
[3] https://review.opendev.org/c/openstack/kayobe/+/807128
[4] https://review.opendev.org/c/openstack/kolla-ansible/+/770618

Change-Id: I4cad83c92c32d1db2a5d3c03a78a1c533a8b9633
Co-Authored-By: Mark Goddard <mark@stackhpc.com>
2021-09-03 23:10:39 +02:00

76 lines
2.9 KiB
YAML

---
# Create a virtualenv for ansible modules to use on the remote target systems
# when running kolla-ansible.
- name: Ensure a virtualenv exists for kolla-ansible
hosts: seed:overcloud
gather_facts: False
vars:
# kolla_overcloud_inventory_top_level_group_map looks like:
# kolla_overcloud_inventory_top_level_group_map:
# control:
# groups:
# - controllers
hosts_in_kolla_inventory: >-
{{ kolla_overcloud_inventory_top_level_group_map.values() |
map(attribute='groups') | flatten | unique | union(['seed']) | join(':') }}
tags:
- kolla-ansible
- kolla-target-venv
tasks:
- block:
- name: Gather facts
setup:
when: not ansible_facts.module_setup | default(false)
- name: Ensure the Python virtualenv package is installed
package:
name: python3-virtualenv
state: present
cache_valid_time: "{{ apt_cache_valid_time if ansible_facts.os_family == 'Debian' else omit }}"
update_cache: "{{ True if ansible_facts.os_family == 'Debian' else omit }}"
become: True
- name: Ensure kolla-ansible virtualenv has the latest version of pip installed
pip:
name: pip
state: latest
virtualenv: "{{ kolla_ansible_target_venv }}"
# Site packages are required for using the dnf python module, which
# is not available via PyPI.
virtualenv_site_packages: True
virtualenv_python: "python3.{{ ansible_facts.python.version.minor }}"
become: True
- name: Ensure kolla-ansible virtualenv has docker SDK for python installed
pip:
name: docker
state: latest
virtualenv: "{{ kolla_ansible_target_venv }}"
# FIXME(mgoddard): docker 5.0.1 is currently in master
# upper-constraints, but fails with an unexpected keyword argument,
# 'disable_buffering'. Install it without UC for now.
# extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
become: True
- name: Ensure kolla-ansible virtualenv has SELinux bindings installed
pip:
name: selinux
state: latest
virtualenv: "{{ kolla_ansible_target_venv }}"
become: True
when:
- ansible_facts.os_family == 'RedHat'
- name: Ensure kolla-ansible virtualenv has correct ownership
file:
path: "{{ kolla_ansible_target_venv }}"
recurse: True
state: directory
owner: "{{ kolla_ansible_user }}"
group: "{{ kolla_ansible_group }}"
become: True
when:
- kolla_ansible_target_venv is not none
- inventory_hostname in query('inventory_hostnames', hosts_in_kolla_inventory)