openstack-operator/playbooks/functional/devstack.yaml
okozachenko 8f4c440970 Fix tempest host inventory
Change-Id: I46f4fc39943ae51514f909a28e0046b2ebb2b94f
2020-08-04 16:49:01 +03:00

114 lines
4.7 KiB
YAML

---
# Copyright (c) 2020 VEXXHOST, 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.
- hosts: all
tasks:
- name: Get Memcached IP address
command: kubectl get svc/mcrouter-memcached-devstack -o=jsonpath='{.spec.clusterIP}'
register: _memcached_ip
- name: Get RabbitMQ IP address
command: kubectl get svc/rabbitmq-sample -o=jsonpath='{.spec.clusterIP}'
register: _rabbitmq_ip
# NOTE(mnaser): We need to rewrite the devstack local.conf because it happens
# inside pre.yaml right now. This should all be gone once the
# operator can deploy OpenStack entirely by itself.
- name: Gather minimum local MTU
set_fact:
local_mtu: >
{% set mtus = [] -%}
{% for interface in ansible_interfaces -%}
{% set interface_variable = 'ansible_' + interface -%}
{% if interface_variable in hostvars[inventory_hostname] -%}
{% set _ = mtus.append(hostvars[inventory_hostname][interface_variable]['mtu']|int) -%}
{% endif -%}
{% endfor -%}
{{- mtus|min -}}
- name: Calculate external_bridge_mtu
# 50 bytes is overhead for vxlan (which is greater than GRE
# allowing us to use either overlay option with this MTU.
# TODO(andreaf) This should work, but it may have to be reconcilied with
# the MTU setting used by the multinode setup roles in multinode pre.yaml
set_fact:
external_bridge_mtu: "{{ local_mtu | int - 50 }}"
- name: Define additional devstack_localrc values
set_fact:
_devstack_localrc: "{{ devstack_localrc }}"
_devstack_localrc_extra:
CELLSV2_SETUP: singleconductor
MEMCACHE_SERVERS: "{{ _memcached_ip.stdout }}:11211"
RABBIT_HOST: "{{ _rabbitmq_ip.stdout }}"
DATABASE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
ERROR_ON_CLONE: True
- name: Re-write local.conf
include_role:
name: write-devstack-local-conf
vars:
devstack_localrc: "{{ _devstack_localrc | combine(_devstack_localrc_extra) }}"
- name: Copy Zuul repo into devstack working directory
become: true
command: rsync -av src/opendev.org/vexxhost/openstack-operator /opt/stack
- name: Copy heat repo into devstack working directory
git:
repo: https://github.com/openstack/heat
dest: /opt/stack/heat
become: true
- name: Override heat lib functions
become: true
command: rsync -av src/opendev.org/vexxhost/openstack-operator/devstack/lib/heat /opt/stack/heat/devstack/lib/heat
- name: Copy magnum repo into devstack working directory
git:
repo: https://github.com/openstack/magnum
dest: /opt/stack/magnum
become: true
- name: Override magnum lib functions
become: true
command: rsync -av src/opendev.org/vexxhost/openstack-operator/devstack/lib/magnum /opt/stack/magnum/devstack/lib/magnum
- name: Override magnum plugin.sh
become: true
command: rsync -av src/opendev.org/vexxhost/openstack-operator/devstack/plugin-magnum.sh /opt/stack/magnum/devstack/plugin.sh
# Changes that run through devstack-tempest are likely to have an impact on
# the devstack part of the job, so we keep devstack in the main play to
# avoid zuul retrying on legitimate failures.
- hosts: all
pre_tasks:
- name: Set the context with openstack namespace
command: kubectl config set-context --current --namespace=openstack
- name: Update resolv.conf to point to the coredns
become: true
shell: |
cat <<EOF> /etc/resolv.conf
search svc.cluster.local cluster.local
nameserver 10.96.0.10
options ndots:5
EOF
roles:
- orchestrate-devstack
# We run tests only on one node, regardless how many nodes are in the system
- hosts: all
environment:
# This enviroment variable is used by the optional tempest-gabbi
# job provided by the gabbi-tempest plugin. It can be safely ignored
# if that plugin is not being used.
GABBI_TEMPEST_PATH: "{{ gabbi_tempest_path | default('') }}"
roles:
- setup-tempest-run-dir
- setup-tempest-data-dir
- acl-devstack-files
- run-tempest