openstack-ansible-os_tempest/tasks/tempest_resources.yml
Michael Gugino ebe3295979 Enable broader image support
Currently, many values are hard-coded for
cirros images during tempest testing.  In
order to provide support for a wider variety
of system images, some variables have been
renamed to a more generic ``tempest_`` form
instead of the ``cirros_`` form.  Other
variables have been added to make the role
more configurable.

Additionally, many unsupported and deprecated
options still existed in this role.  These
deprecated options centered largely around
tempest.conf.j2.  Of particular note, ari/ami/aki
images have been deprecated by tempest, and
those options have been removed.

The '[boto]' testing section is no longer implemented
in tempest testing, and has been removed.

Change-Id: Ibbe2cc09416963d2326dd760c36c8a985f636734
2016-08-03 21:32:15 -04:00

370 lines
11 KiB
YAML

---
# Copyright 2014, 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.
- name: Ensure tempest image
glance:
command: 'image-create'
openrc_path: /root/openrc
image_name: "{{ tempest_img_name }}"
image_url: "{{ tempest_img_url }}"
image_container_format: bare
image_disk_format: "{{ tempest_img_disk_format }}"
image_is_public: True
insecure: "{{ keystone_service_internaluri_insecure }}"
register: tempest_image_create
until: tempest_image_create | success
retries: 5
delay: 15
when: tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
- name: Store tempest image id
set_fact:
tempest_glance_image_id: "{{ glance_images[tempest_img_name].id }}"
when: tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get
# set above to ensure the template will parse correctly.
- name: Store empty tempest_glance_image_id fact
set_fact:
tempest_glance_image_id: ''
when: not tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
- name: Ensure alt tempest image
glance:
command: 'image-create'
openrc_path: /root/openrc
image_name: "{{ tempest_img_name }}_alt"
image_url: "{{ tempest_img_url }}"
image_container_format: bare
image_disk_format: "{{ tempest_img_disk_format }}"
image_is_public: True
insecure: "{{ keystone_service_internaluri_insecure }}"
when: tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
- name: Store alt tempest image id
set_fact:
tempest_glance_image_alt_id: "{{ glance_images[tempest_img_name + '_alt'].id }}"
when: tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get
# set above to ensure the template will parse correctly.
- name: Store empty tempest_glance_image_alt_id fact
set_fact:
tempest_glance_image_alt_id: ''
when: not tempest_service_available_glance | bool
tags:
- tempest-setup
- tempest-config
- name: Ensure tempest tenants
keystone:
command: ensure_tenant
tenant_name: "{{ item }}"
description: "{{ item }} Tenant"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
with_items:
- demo
- alt_demo
tags:
- tempest-setup
- name: Ensure tempest users
keystone:
command: ensure_user
tenant_name: "{{ item }}"
user_name: "{{ item }}"
password: "{{ item }}"
description: "{{ item }} User"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
with_items:
- demo
- alt_demo
tags:
- tempest-setup
- name: Ensure tempest users have heat_stack_owner role
keystone:
command: ensure_user_role
tenant_name: "{{ item }}"
user_name: "{{ item }}"
role_name: heat_stack_owner
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
when: tempest_service_available_heat | bool
with_items:
- demo
- alt_demo
tags:
- tempest-setup
- name: Ensure reseller_admin role
keystone:
command: ensure_role
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
role_name: "reseller_admin"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- tempest-setup
- name: Ensure remote_image role exists
keystone:
command: ensure_role
role_name: remote_image
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- tempest-setup
- name: Get demo tenant id
keystone:
command: get_tenant
tenant_name: demo
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- tempest-setup
- tempest-config
- name: Store demo tenant id
set_fact:
keystone_demo_tenant_id: "{{ keystone_facts.id }}"
tags:
- tempest-setup
- tempest-config
- name: Ensure private network exists
neutron:
command: create_network
openrc_path: /root/openrc
net_name: private
provider_network_type: "{{ tempest_private_net_provider_type }}"
provider_segmentation_id: "{{ tempest_private_net_seg_id }}"
tenant_id: "{{ keystone_demo_tenant_id }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- tempest-config
- name: Store neutron private network id
set_fact:
tempest_neutron_private_network_id: "{{ neutron_networks.private.id }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- tempest-config
- name: Ensure public network exists (if flat)
neutron:
command: create_network
openrc_path: /root/openrc
net_name: public
provider_network_type: "{{ tempest_public_net_provider_type }}"
provider_physical_network: "{{ tempest_public_net_physical_type }}"
router_external: "{{ tempest_public_router_external }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
when:
- tempest_service_available_neutron | bool
- tempest_public_net_provider_type == "flat"
tags:
- tempest-setup
- tempest-config
- name: Ensure public network exists (if vlan)
neutron:
command: create_network
openrc_path: /root/openrc
net_name: public
provider_network_type: "{{ tempest_public_net_provider_type }}"
provider_physical_network: "{{ tempest_public_physical_net_type }}"
provider_segmentation_id: "{{ tempest_public_net_seg_id }}"
router_external: "{{ tempest_public_router_external }}"
tenant_id: "{{ keystone_demo_tenant_id }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
when:
- tempest_service_available_neutron | bool
- tempest_public_net_provider_type == "vlan"
tags:
- tempest-setup
- tempest-config
- name: Store neutron public network id
set_fact:
tempest_neutron_public_network_id: "{{ neutron_networks.public.id }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- tempest-config
# This fact is used in tempest.conf.j2; we set an empty string if it doesn't get
# set above to ensure the template will parse correctly.
- name: Store empty tempest_neutron_public_network_id fact
set_fact:
tempest_neutron_public_network_id: ''
when: not tempest_service_available_neutron | bool
tags:
- tempest-setup
- tempest-config
- name: Ensure private subnet exists
neutron:
command: create_subnet
openrc_path: /root/openrc
net_name: private
subnet_name: private-subnet
cidr: "{{ tempest_private_subnet_cidr }}"
tenant_id: "{{ keystone_demo_tenant_id }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- name: Ensure public subnet exists
neutron:
command: create_subnet
openrc_path: /root/openrc
net_name: public
subnet_name: public-subnet
cidr: "{{ tempest_public_subnet_cidr }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
allocation_pools: "{{ tempest_public_subnet_allocation_pools }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- name: Create router
neutron:
command: create_router
openrc_path: /root/openrc
router_name: router
external_gateway_info: public
tenant_id: "{{ keystone_demo_tenant_id }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- name: Add private subnet to router
neutron:
command: add_router_interface
openrc_path: /root/openrc
router_name: router
subnet_name: private-subnet
insecure: "{{ keystone_service_internaluri_insecure }}"
when: tempest_service_available_neutron | bool
tags:
- tempest-setup
- name: Check if tempest flavor 201 exists
shell: |
. /root/openrc
nova flavor-show tempest1
register: tempest1
failed_when: False
changed_when: tempest1.rc != 0
when: tempest_service_available_nova | bool
tags:
- tempest-setup
- name: Create tempest flavor 201
shell: |
. /root/openrc
nova flavor-create tempest1 201 256 1 1
when:
- tempest_service_available_nova | bool
- tempest1.rc != 0
tags:
- tempest-setup
- name: Check if tempest flavor 202 exists
shell: |
. /root/openrc
nova flavor-show tempest2
register: tempest2
failed_when: False
changed_when: tempest2.rc != 0
when: tempest_service_available_nova | bool
tags:
- tempest-setup
- name: Create tempest flavor 202
shell: |
. /root/openrc
nova flavor-create tempest2 202 512 1 1
when:
- tempest_service_available_nova | bool
- tempest2.rc != 0
tags:
- tempest-setup