132 lines
3.4 KiB
YAML
132 lines
3.4 KiB
YAML
---
|
|
- module_defaults:
|
|
group/openstack.cloud.openstack:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ test_project }}"
|
|
# Backward compatibility with Ansible 2.9
|
|
openstack.cloud.project:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ test_project }}"
|
|
openstack.cloud.quota:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ test_project }}"
|
|
block:
|
|
- name: Create test project
|
|
openstack.cloud.project:
|
|
state: present
|
|
|
|
- name: Clear quotas before tests
|
|
openstack.cloud.quota:
|
|
state: absent
|
|
register: default_quotas
|
|
|
|
- name: Set network quota
|
|
openstack.cloud.quota: "{{ test_network_quota }}"
|
|
register: quotas
|
|
|
|
- name: Assert changed
|
|
assert:
|
|
that: quotas is changed
|
|
|
|
- name: Assert field values
|
|
assert:
|
|
that: quotas.quotas.network[item.key] == item.value
|
|
loop: "{{ test_network_quota | dict2items }}"
|
|
|
|
- name: Set network quota again
|
|
openstack.cloud.quota: "{{ test_network_quota }}"
|
|
register: quotas
|
|
|
|
- name: Assert not changed
|
|
assert:
|
|
that: quotas is not changed
|
|
|
|
- name: Set volume quotas
|
|
openstack.cloud.quota: "{{ test_volume_quota }}"
|
|
register: quotas
|
|
|
|
- name: Assert changed
|
|
assert:
|
|
that: quotas is changed
|
|
|
|
- name: Assert field values
|
|
assert:
|
|
that: quotas.quotas.volume[item.key] == item.value
|
|
loop: "{{ test_volume_quota | dict2items }}"
|
|
|
|
- name: Set volume quotas again
|
|
openstack.cloud.quota: "{{ test_volume_quota }}"
|
|
register: quotas
|
|
|
|
- name: Assert not changed
|
|
assert:
|
|
that: quotas is not changed
|
|
|
|
- name: Set compute quotas
|
|
openstack.cloud.quota: "{{ test_compute_quota }}"
|
|
register: quotas
|
|
|
|
- name: Assert changed
|
|
assert:
|
|
that: quotas is changed
|
|
|
|
- name: Assert field values
|
|
assert:
|
|
that: quotas.quotas.compute[item.key] == item.value
|
|
loop: "{{ test_compute_quota | dict2items }}"
|
|
|
|
- name: Set compute quotas again
|
|
openstack.cloud.quota: "{{ test_compute_quota }}"
|
|
register: quotas
|
|
|
|
- name: Unset all quotas
|
|
openstack.cloud.quota:
|
|
state: absent
|
|
register: quotas
|
|
|
|
- name: Assert defaults restore
|
|
assert:
|
|
that: quotas.quotas == default_quotas.quotas
|
|
|
|
- name: Set all quotas at once
|
|
openstack.cloud.quota:
|
|
"{{ [test_network_quota, test_volume_quota, test_compute_quota] | combine }}"
|
|
register: quotas
|
|
|
|
- name: Assert changed
|
|
assert:
|
|
that: quotas is changed
|
|
|
|
- name: Assert volume values
|
|
assert:
|
|
that: quotas.quotas.volume[item.key] == item.value
|
|
loop: "{{ test_volume_quota | dict2items }}"
|
|
|
|
- name: Assert network values
|
|
assert:
|
|
that: quotas.quotas.network[item.key] == item.value
|
|
loop: "{{ test_network_quota | dict2items }}"
|
|
|
|
- name: Assert compute values
|
|
assert:
|
|
that: quotas.quotas.compute[item.key] == item.value
|
|
loop: "{{ test_compute_quota | dict2items }}"
|
|
|
|
- name: Set all quotas at once again
|
|
openstack.cloud.quota:
|
|
"{{ [test_network_quota, test_volume_quota, test_compute_quota] | combine }}"
|
|
register: quotas
|
|
|
|
- name: Assert not changed
|
|
assert:
|
|
that: quotas is not changed
|
|
|
|
- name: Unset all quotas
|
|
openstack.cloud.quota:
|
|
state: absent
|
|
register: quotas
|
|
|
|
- name: Delete test project
|
|
openstack.cloud.project:
|
|
state: absent
|