openstack-ansible-os_tempest/tasks/tempest_resources.yml
Jesse Pretorius 2da1abfde5 Do not log passwords
This prevents data to be leaked into the callback plugin.

Change-Id: Ie6c71c11c1b37306c96351d41d0fd544c82aba89
2018-04-18 11:58:56 +01:00

257 lines
8.7 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: Ensures you have at least one image to upload
assert:
that:
- "tempest_images | length > 0"
when:
- tempest_service_available_glance | bool
- name: Create deployment-host tempest_image_dir
file:
path: "{{ tempest_image_dir }}"
state: directory
delegate_to: localhost
when:
- tempest_service_available_glance | bool
- tempest_image_downloader == "deployment-host"
- name: Image(s) download
get_url:
url: "{{ item.url }}"
dest: "{{ tempest_image_dir }}/"
checksum: "{{ item.checksum | default(omit) }}"
with_items: "{{ tempest_images }}"
when: tempest_service_available_glance | bool
register: fetch_url
until: fetch_url | success
retries: 6
delay: 5
delegate_to: "{{ (tempest_image_downloader == 'deployment-host') | ternary('localhost', inventory_hostname) }}"
- name: Copy download images from deployment-host to target-host
copy:
src: "{{ tempest_image_dir }}/{{ item.url | basename }}"
dest: "{{ tempest_image_dir }}/"
with_items: "{{ tempest_images }}"
when:
- tempest_service_available_glance | bool
- tempest_image_downloader == "deployment-host"
register: fetch_url
until: fetch_url | success
retries: 6
delay: 5
- name: Upload tempest images to glance
os_image:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ item.name | default(item.url | basename) }}"
filename: "{{ tempest_image_dir }}/{{ item.url | basename }}"
container_format: bare
disk_format: "{{ item.format }}"
is_public: True
with_items: "{{ tempest_images }}"
register: tempest_image_create
until: tempest_image_create | success
retries: 5
delay: 15
when: tempest_service_available_glance | bool
# These facts are used in tempest.conf.j2; we set an empty string if it is not
# set above to ensure the template will parse correctly.
- name: Store first tempest image id
set_fact:
tempest_glance_image_id_1: "{{ tempest_service_available_glance | ternary(tempest_image_create['results'][0]['id'], '') }}"
tempest_glance_image_id_2: "{{ tempest_service_available_glance | ternary(tempest_image_create['results'][-1]['id'], '') }}"
- 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
no_log: True
- 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
no_log: True
- name: Ensure tempest roles
os_keystone_role:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ item }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
with_items: "{{ tempest_roles }}"
- 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
no_log: True
- 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
no_log: True
- name: Store demo tenant id
set_fact:
keystone_demo_tenant_id: "{{ keystone_facts.id }}"
- name: Ensure private network exists
os_network:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ tempest_private_net_name }}"
provider_network_type: "{{ tempest_private_net_provider_type }}"
provider_segmentation_id: "{{ tempest_private_net_seg_id | default(omit) }}"
project: "{{ keystone_demo_tenant_id }}"
register: tempest_private_network
when: tempest_service_available_neutron | bool
- name: Store neutron private network id
set_fact:
tempest_neutron_private_network_id: "{{ tempest_private_network.id }}"
when: tempest_service_available_neutron | bool
- name: Ensure public network exists
os_network:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ tempest_public_net_name }}"
provider_network_type: "{{ tempest_public_net_provider_type }}"
provider_physical_network: "{{ tempest_public_net_physical_type | default(omit) }}"
provider_segmentation_id: "{{ tempest_public_net_seg_id | default(omit) }}"
external: "{{ tempest_public_router_external }}"
project: "{{ keystone_demo_tenant_id }}"
register: tempest_public_network
when: tempest_service_available_neutron | bool
- name: Store neutron public network id
set_fact:
tempest_neutron_public_network_id: "{{ tempest_service_available_neutron | ternary(tempest_public_network.id, '') }}"
- name: Ensure private subnet exists
os_subnet:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
network_name: "{{ tempest_private_net_name }}"
name: "{{ tempest_private_subnet_name }}"
cidr: "{{ tempest_private_subnet_cidr }}"
project: "{{ keystone_demo_tenant_id }}"
when: tempest_service_available_neutron | bool
- name: Ensure public subnet exists
os_subnet:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
network_name: "{{ tempest_public_net_name }}"
name: "{{ tempest_public_subnet_name }}"
cidr: "{{ tempest_public_subnet_cidr }}"
allocation_pool_start: "{{ tempest_public_subnet_allocation_pools.split('-')[0] | default(omit) }}"
allocation_pool_end: "{{ tempest_public_subnet_allocation_pools.split('-')[1] | default(omit) }}"
gateway_ip: "{{ tempest_public_subnet_gateway_ip | default(omit) }}"
when: tempest_service_available_neutron | bool
- name: Create router
os_router:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: router
network: "{{ tempest_public_net_name }}"
interfaces:
- "{{ tempest_private_subnet_name }}"
project: "{{ keystone_demo_tenant_id }}"
when: tempest_service_available_neutron | bool
- name: Create tempest flavors
os_nova_flavor:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ item.name }}"
flavorid: "{{ item.id }}"
ram: "{{ item.ram }}"
disk: "{{ item.disk }}"
vcpus: "{{ item.vcpus }}"
with_items: "{{ tempest_flavors }}"
when: tempest_service_available_nova | bool