bd9f0c0723
1. Remove tests/test-configure-octavia.yml because the 'shade' package does not need to be installed again - this is already done by the role test preparation. 2. Remove the key generation as the keys are already generated in the common tests playbook 'test-prepare-keys.yml'. 3. Add some spacing between tasks to make it more readable. 4. Implement the extra packages needed in test-requirements.txt instead of trying to use a task to install them, because doing it in Ansible makes understanding the venv in relation to the inventory complicated.. 5. Move the vars_files argument to the top of the play to make it easier to find and more uniform with other plays in OSA. 6. Switch from using octavia_ansible_endpoint_type to a hard-coded endpoint, then remove the octavia_ansible_endpoint_type var. 7. Switch from using the 'endpoint_type' argument for the openstack modules to using the more modern 'interface' argument. 8. Remove the 'run_once' argument on the 'Upload key to nova' task because only localhost is targeted, so the argument is moot. 9. Remove the 'Set VIP fact' task in favor of just using the 'vip_output' register in the 'Test the Listener' task. Setting a fact is pointless. 10. To help the existing patches pass, we add python-pip to the distro packages. This will be reverted later once the required changes to remove this requirement have merged. Depends-On: https://review.openstack.org/589248 Change-Id: I46962090f7baf4227e838e125fd318245f2bcb85
159 lines
5.1 KiB
YAML
159 lines
5.1 KiB
YAML
---
|
|
# Copyright 2016, 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: Test Octavia
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: no
|
|
vars_files:
|
|
- common/test-vars.yml
|
|
vars:
|
|
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
|
octavia_service_user_name: octavia
|
|
octavia_service_project_name: service
|
|
octavia_service_user_domain_id: default
|
|
octavia_service_project_domain_id: default
|
|
env:
|
|
OS_ENDPOINT_TYPE: internalURL
|
|
OS_INTERFACE: internalURL
|
|
OS_USERNAME: admin
|
|
OS_PASSWORD: "{{ keystone_auth_admin_password }}"
|
|
OS_PROJECT_NAME: admin
|
|
OS_TENANT_NAME: admin
|
|
OS_AUTH_URL: "http://{{ test_keystone_host }}:5000/v3"
|
|
OS_NO_CACHE: 1
|
|
OS_USER_DOMAIN_NAME: Default
|
|
OS_PROJECT_DOMAIN_NAME: Default
|
|
OS_REGION_NAME: RegionOne
|
|
OS_IDENTITY_API_VERSION: 3
|
|
OS_AUTH_VERSION: 3
|
|
tasks:
|
|
- name: Ensure public network exists
|
|
os_network:
|
|
auth:
|
|
auth_url: "{{ keystone_service_adminurl }}"
|
|
username: "{{ octavia_service_user_name }}"
|
|
password: "{{ octavia_service_password }}"
|
|
project_name: "{{ octavia_service_project_name }}"
|
|
user_domain_name: "{{ octavia_service_user_domain_id }}"
|
|
project_domain_name: "{{ octavia_service_project_domain_id }}"
|
|
interface: admin
|
|
state: present
|
|
name: "public"
|
|
provider_network_type: "flat"
|
|
provider_physical_network: "flat"
|
|
external: True
|
|
|
|
- name: Ensure public subnet exists
|
|
os_subnet:
|
|
auth:
|
|
auth_url: "{{ keystone_service_adminurl }}"
|
|
username: "{{ octavia_service_user_name }}"
|
|
password: "{{ octavia_service_password }}"
|
|
project_name: "{{ octavia_service_project_name }}"
|
|
user_domain_name: "{{ octavia_service_user_domain_id }}"
|
|
project_domain_name: "{{ octavia_service_project_domain_id }}"
|
|
interface: admin
|
|
state: present
|
|
network_name: "public"
|
|
name: "public-subnet"
|
|
cidr: "10.1.3.0/24"
|
|
|
|
- name: Upload key to nova
|
|
os_keypair:
|
|
auth:
|
|
auth_url: "{{ keystone_service_adminurl }}"
|
|
username: "{{ octavia_service_user_name }}"
|
|
password: "{{ octavia_service_password }}"
|
|
project_name: "{{ octavia_service_project_name }}"
|
|
user_domain_name: "{{ octavia_service_user_domain_id }}"
|
|
project_domain_name: "{{ octavia_service_project_domain_id }}"
|
|
interface: admin
|
|
state: present
|
|
name: "octavia_key"
|
|
public_key_file: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa.pub"
|
|
|
|
- name: Create a loadbalancer
|
|
shell: >
|
|
openstack --debug loadbalancer create --name test-lb --vip-subnet-id public-subnet
|
|
environment: "{{ env }}"
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Wait until LB is active
|
|
shell: >
|
|
openstack loadbalancer show test-lb -c provisioning_status -f value
|
|
environment: "{{ env }}"
|
|
register: lb_active
|
|
until: lb_active.stdout == "ACTIVE"
|
|
failed_when: lb_active.stdout == "ERROR"
|
|
retries: 50
|
|
delay: 10
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Create a listener
|
|
shell: >
|
|
openstack loadbalancer listener create --protocol HTTP --protocol-port 80 --name listener test-lb
|
|
environment: "{{ env }}"
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Wait until Listener is active
|
|
shell: >
|
|
openstack loadbalancer show test-lb -c provisioning_status -f value
|
|
environment: "{{ env }}"
|
|
register: lb_active
|
|
until: lb_active.stdout == "ACTIVE"
|
|
failed_when: lb_active.stdout == "ERROR"
|
|
retries: 10
|
|
delay: 10
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Run Show (for debugging)
|
|
shell: >
|
|
openstack loadbalancer show test-lb
|
|
environment: "{{ env }}"
|
|
when:
|
|
- debug | bool
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Register VIP IP # this is likley changing with a newer version of octaviaclient
|
|
shell: >
|
|
openstack loadbalancer show test-lb -c vip_address -f value
|
|
environment: "{{ env }}"
|
|
register: vip_output
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Test the Listener
|
|
uri:
|
|
url: "http://{{ vip_output.stdout }}"
|
|
status_code: 503
|
|
when: test_octavia_amphora | bool
|
|
|
|
- name: Delete LoadBalancer
|
|
shell: >
|
|
openstack loadbalancer delete --cascade test-lb
|
|
environment: "{{ env }}"
|
|
register: lb_deleted
|
|
until: lb_deleted is success
|
|
retries: 10
|
|
delay: 15
|
|
tags:
|
|
- skip_ansible_lint
|