
Backport: Stein, Rocky, Queens In https://review.opendev.org/#/c/671502/ kolla ansible virtualenv creation was modified to only happen on hosts in the kolla-ansible inventory. However, that change omitted the seed. It passed CI because the seed and overcloud are both in the inventory. This change adds the seed group to the inventory_hostname lookup. Change-Id: Ib5fb726600debee5df1f7085ea37b583bfccefcf Story: 2006247 Task: 37368
57 lines
2.0 KiB
YAML
57 lines
2.0 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: Ensure the python-virtualenv package is installed
|
|
package:
|
|
name: python-virtualenv
|
|
state: installed
|
|
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 yum and selinux python
|
|
# modules, which are not available via PyPI.
|
|
virtualenv_site_packages: True
|
|
become: True
|
|
|
|
- name: Ensure kolla-ansible virtualenv has docker SDK for python installed
|
|
pip:
|
|
name: docker
|
|
state: latest
|
|
virtualenv: "{{ kolla_ansible_target_venv }}"
|
|
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
|
|
become: True
|
|
|
|
- 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)
|