Update role for new source build process

The variables zun_developer_mode and zun_venv_download
no longer carry any meaning. This review changes zun to
do the equivalent of what developer_mode was all the time,
meaning that it always builds the venv and never requires
the repo server, but it will use a repo server when available.

As part of this, we move the installation out of its own file
because it's now a single task to include the venv build role.
This is just to make it easier to follow the code.

We also change include_tasks to import_tasks and include_role
to import_role so that the tags in the python_venv_build role
will work.

As part of commit xenial testing was removed. Instead centos 7
and opensuse 15 functional tests were added.

Change-Id: Ic8fc09372cf7397df6757c115b2c05dbb5db68f1
This commit is contained in:
Dmitriy Rabotjagov 2019-03-28 14:05:16 +02:00
parent 833690fef8
commit 0684afa2c5
9 changed files with 32 additions and 90 deletions

View File

@ -43,31 +43,18 @@ zun_git_install_branch: master
zun_kuryr_git_repo: https://git.openstack.org/openstack/kuryr-libnetwork
zun_kuryr_git_install_branch: master
zun_developer_mode: false
zun_developer_constraints:
zun_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}"
zun_git_constraints:
- "git+{{ zun_git_repo }}@{{ zun_git_install_branch }}#egg=zun"
- "git+{{ zun_kuryr_git_repo }}@{{ zun_kuryr_git_install_branch }}#egg=kuryr-libnetwork"
- "--constraint {{ zun_upper_constraints_url }}"
# TODO(odyssey4me):
# This can be simplified once all the roles are using
# python_venv_build. We can then switch to using a
# set of constraints in pip.conf inside the venv,
# perhaps prepared by giving a giving a list of
# constraints to the role.
zun_pip_install_args: >-
{{ zun_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }}
{{ pip_install_options | default('') }}
zun_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
zun_venv_tag: "{{ venv_tag | default('untagged') }}"
zun_bin: "/openstack/venvs/zun-{{ zun_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
zun_venv_download: "{{ not zun_developer_mode | bool }}"
zun_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/zun.tgz
zun_fatal_deprecations: False
## Zun user information

View File

@ -24,15 +24,27 @@
tags:
- always
- include_tasks: zun_pre_flight.yml
- import_tasks: zun_pre_flight.yml
tags:
- always
- include_tasks: zun_pre_install.yml
- import_tasks: zun_pre_install.yml
tags:
- zun-install
- include_tasks: zun_install.yml
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ zun_git_constraints }}"
venv_install_destination_path: "{{ zun_bin | dirname }}"
venv_install_distro_package_list: "{{ zun_distro_packages }}"
venv_pip_install_args: "{{ zun_pip_install_args }}"
venv_pip_packages: "{{ zun_pip_packages | union((zun_oslomsg_amqp1_enabled | bool) | ternary(zun_optional_oslomsg_amqp1_pip_packages, [])) }}"
venv_facts_when_changed:
- section: "zun"
option: "venv_tag"
value: "{{ zun_venv_tag }}"
tags:
- zun-install
@ -56,27 +68,27 @@
- common-mq
- zun-config
- include_tasks: zun_db_setup.yml
- import_tasks: zun_db_setup.yml
when:
- "zun_services['zun-api']['group'] in group_names"
- "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]"
tags:
- zun-config
- include_tasks: zun_service_setup.yml
- import_tasks: zun_service_setup.yml
when:
- "zun_services['zun-api']['group'] in group_names"
- "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]"
tags:
- zun-config
- include_tasks: zun_compute.yml
- import_tasks: zun_compute.yml
when:
- "zun_services['zun-compute']['group'] in group_names"
tags:
- zun-compute
- include_tasks: zun_post_install.yml
- import_tasks: zun_post_install.yml
tags:
- zun-config
@ -108,7 +120,7 @@
- systemd-service
- name: Run the etcd service role
include_role:
import_role:
name: etcd
vars:
etcd_cluster_group: "zun_api"

View File

@ -193,7 +193,7 @@
- name: Ensure docker users are added to the docker group
user:
name: "{{ item }}"
group: docker
group: "{{ zun_docker_groupname }}"
append: yes
with_items: "{{ zun_docker_users }}"

View File

@ -1,49 +0,0 @@
---
# Copyright 2018, Rackspace US, Inc.
#
# 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.
# TODO(odyssey4me):
# This can be simplified once all the roles are using
# python_venv_build. We can then switch to using a
# set of constraints in pip.conf inside the venv,
# perhaps prepared by giving a giving a list of
# constraints to the role.
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"
content: |
{% for item in zun_developer_constraints %}
{{ item }}
{% endfor %}
when:
- zun_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ ansible_hostname }}"
when:
- zun_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_install_destination_path: "{{ zun_bin | dirname }}"
venv_install_distro_package_list: "{{ zun_distro_packages }}"
venv_pip_install_args: "{{ zun_pip_install_args }}"
venv_pip_packages: "{{ (zun_oslomsg_amqp1_enabled | bool) | ternary(zun_pip_packages + zun_optional_oslomsg_amqp1_pip_packages, zun_pip_packages) }}"
venv_facts_when_changed:
- section: "zun"
option: "venv_tag"
value: "{{ zun_venv_tag }}"

View File

@ -26,7 +26,6 @@
zun_galera_password: secrete
zun_service_password: secrete
zun_kuryr_service_password: secrete
zun_developer_mode: true
zun_service_publicuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"
zun_service_adminuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"
zun_service_internaluri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"

View File

@ -24,3 +24,5 @@ zun_distro_packages:
zun_distro_compute_packages:
- docker
- pciutils
zun_docker_groupname: dockerroot

View File

@ -27,3 +27,5 @@ zun_distro_packages:
zun_distro_compute_packages:
- docker-ce
- pciutils
zun_docker_groupname: dockerroot

View File

@ -29,5 +29,7 @@ zun_distro_compute_packages:
- docker-ce
- pciutils
zun_docker_groupname: docker
## APT Cache options
cache_timeout: 600

View File

@ -14,19 +14,6 @@
- project:
templates:
- check-requirements
- openstack-ansible-role-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
check:
jobs:
- openstack-ansible-linters
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-functional-ubuntu-bionic
experimental:
jobs:
- openstack-ansible-integrated-deploy-aio
gate:
jobs:
- openstack-ansible-linters
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-functional-ubuntu-bionic