126a547f04
While we get a proper os_quota module in Ansible, let's just workaround it with good old openstack client. Change-Id: I4036359b09f5bb534143dcb18abe57586b6c8740
135 lines
4.5 KiB
YAML
135 lines
4.5 KiB
YAML
# Copyright 2016 Hewlett-Packard Enterprise, 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: test
|
|
become: yes
|
|
vars:
|
|
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
|
|
|
|
roles:
|
|
- "{{ rolename }}"
|
|
|
|
post_tasks:
|
|
- name: Querying for test_domain domain
|
|
command: openstack --os-cloud devstack-admin domain show test_domain
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_domain domain has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_project project
|
|
command: openstack --os-cloud devstack-admin project show test_project --domain test_domain
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_project project has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_user user
|
|
command: openstack --os-cloud devstack-admin user show test_user --domain test_domain
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_user user has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_role role
|
|
command: openstack --os-cloud devstack-admin role show test_role
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_role role has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_user role assignment
|
|
command: openstack --os-cloud devstack-admin role assignment list --user test_user --names -f value -c Role
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_user has test_role role assigned
|
|
assert: { that: result.stdout == 'test_role' }
|
|
|
|
- name: Querying for test_project quotas
|
|
command: openstack --os-cloud devstack-admin quota show -c cores -f value test_project
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_project has quotas assigned
|
|
assert: { that: result.stdout == '2' }
|
|
|
|
- name: Querying for test_server_a server
|
|
command: openstack --os-cloud devstack-admin server show test_server_a
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test-server-a server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_image image
|
|
command: openstack --os-cloud devstack-admin image show test_image
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_image server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_server_b server
|
|
command: openstack --os-cloud devstack server show test_server_b
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_server_a server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_network network
|
|
command: openstack --os-cloud devstack network show test_network
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test-network network has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_cluster01 server
|
|
command: openstack --os-cloud devstack server show test_cluster01
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_cluster01 server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_cluster02 server
|
|
command: openstack --os-cloud devstack server show test_cluster02
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_cluster02 server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_cluster01.testdomain server
|
|
command: openstack --os-cloud devstack server show test_cluster01.testdomain
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_cluster01.testdomain server has been created
|
|
assert: { that: result.rc == 0 }
|
|
|
|
- name: Querying for test_cluster02.testdomain server
|
|
command: openstack --os-cloud devstack server show test_cluster02.testdomain
|
|
register: result
|
|
changed_when: False
|
|
|
|
- name: Assert test_cluster02.testdomain server has been created
|
|
assert: { that: result.rc == 0 }
|