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_repo: https://git.openstack.org/openstack/kuryr-libnetwork
zun_kuryr_git_install_branch: master zun_kuryr_git_install_branch: master
zun_developer_mode: false 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_developer_constraints: zun_git_constraints:
- "git+{{ zun_git_repo }}@{{ zun_git_install_branch }}#egg=zun" - "git+{{ zun_git_repo }}@{{ zun_git_install_branch }}#egg=zun"
- "git+{{ zun_kuryr_git_repo }}@{{ zun_kuryr_git_install_branch }}#egg=kuryr-libnetwork" - "git+{{ zun_kuryr_git_repo }}@{{ zun_kuryr_git_install_branch }}#egg=kuryr-libnetwork"
- "--constraint {{ zun_upper_constraints_url }}"
# TODO(odyssey4me): zun_pip_install_args: "{{ pip_install_options | default('') }}"
# 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('') }}
# Name of the virtual env to deploy into # Name of the virtual env to deploy into
zun_venv_tag: "{{ venv_tag | default('untagged') }}" zun_venv_tag: "{{ venv_tag | default('untagged') }}"
zun_bin: "/openstack/venvs/zun-{{ zun_venv_tag }}/bin" 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_fatal_deprecations: False
## Zun user information ## Zun user information

View File

@ -24,15 +24,27 @@
tags: tags:
- always - always
- include_tasks: zun_pre_flight.yml - import_tasks: zun_pre_flight.yml
tags: tags:
- always - always
- include_tasks: zun_pre_install.yml - import_tasks: zun_pre_install.yml
tags: tags:
- zun-install - 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: tags:
- zun-install - zun-install
@ -56,27 +68,27 @@
- common-mq - common-mq
- zun-config - zun-config
- include_tasks: zun_db_setup.yml - import_tasks: zun_db_setup.yml
when: when:
- "zun_services['zun-api']['group'] in group_names" - "zun_services['zun-api']['group'] in group_names"
- "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]" - "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]"
tags: tags:
- zun-config - zun-config
- include_tasks: zun_service_setup.yml - import_tasks: zun_service_setup.yml
when: when:
- "zun_services['zun-api']['group'] in group_names" - "zun_services['zun-api']['group'] in group_names"
- "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]" - "inventory_hostname == ((groups['zun_api'] | intersect(ansible_play_hosts)) | list)[0]"
tags: tags:
- zun-config - zun-config
- include_tasks: zun_compute.yml - import_tasks: zun_compute.yml
when: when:
- "zun_services['zun-compute']['group'] in group_names" - "zun_services['zun-compute']['group'] in group_names"
tags: tags:
- zun-compute - zun-compute
- include_tasks: zun_post_install.yml - import_tasks: zun_post_install.yml
tags: tags:
- zun-config - zun-config
@ -108,7 +120,7 @@
- systemd-service - systemd-service
- name: Run the etcd service role - name: Run the etcd service role
include_role: import_role:
name: etcd name: etcd
vars: vars:
etcd_cluster_group: "zun_api" etcd_cluster_group: "zun_api"

View File

@ -193,7 +193,7 @@
- name: Ensure docker users are added to the docker group - name: Ensure docker users are added to the docker group
user: user:
name: "{{ item }}" name: "{{ item }}"
group: docker group: "{{ zun_docker_groupname }}"
append: yes append: yes
with_items: "{{ zun_docker_users }}" 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_galera_password: secrete
zun_service_password: secrete zun_service_password: secrete
zun_kuryr_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_publicuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"
zun_service_adminuri: "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" 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: zun_distro_compute_packages:
- docker - docker
- pciutils - pciutils
zun_docker_groupname: dockerroot

View File

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

View File

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

View File

@ -14,19 +14,6 @@
- project: - project:
templates: templates:
- check-requirements - openstack-ansible-role-jobs
- publish-openstack-docs-pti - publish-openstack-docs-pti
- release-notes-jobs-python3 - 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