Add quotas support for the cloud launcher
While we get a proper os_quota module in Ansible, let's just workaround it with good old openstack client. Change-Id: I4036359b09f5bb534143dcb18abe57586b6c8740
This commit is contained in:
parent
441d54913f
commit
126a547f04
@ -44,6 +44,15 @@
|
||||
tags:
|
||||
- user_roles
|
||||
|
||||
- name: "Processing quotas resources for profile {{ item_profile }}"
|
||||
include: create_quota.yml
|
||||
with_items: "{{ profiles|selectattr('name', 'equalto', item_profile)|map(attribute='quotas')|list }}"
|
||||
loop_control:
|
||||
loop_var: item_quota
|
||||
when: "{{ 'quotas' in profiles|selectattr('name', 'equalto', item_profile)|list|first }}"
|
||||
tags:
|
||||
- quotas
|
||||
|
||||
- name: "Processing networks resources for profile {{ item_profile }}"
|
||||
include: create_network.yml
|
||||
with_items: "{{ profiles|selectattr('name', 'equalto', item_profile)|map(attribute='networks')|list }}"
|
||||
|
@ -39,6 +39,14 @@
|
||||
tags:
|
||||
- user_roles
|
||||
|
||||
- name: "Processing per cloud quotas"
|
||||
include: create_quota.yml
|
||||
with_items: "{{ item_cloud.quotas|default([]) }}"
|
||||
loop_control:
|
||||
loop_var: item_quota
|
||||
tags:
|
||||
- quotas
|
||||
|
||||
- name: "Processing per cloud networks"
|
||||
include: create_network.yml
|
||||
with_items: "{{ item_cloud.networks|default([]) }}"
|
||||
|
8
tasks/create_quota.yml
Normal file
8
tasks/create_quota.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: "Processing quotas for project {{ item_quota.name }}"
|
||||
command: openstack quota set --"{{ item.key }}" "{{ item.value }}" "{{ item_quota.name }}"
|
||||
environment:
|
||||
OS_CLOUD: "{{ item_cloud.name }}"
|
||||
OS_REGION_NAME: "{{ item_cloud.region_name|default('')}}"
|
||||
with_dict: "{{ item_quota }}"
|
||||
when: item.key != 'name'
|
@ -34,6 +34,11 @@ clouds:
|
||||
- role: test_role
|
||||
user: test_user
|
||||
project: test_project
|
||||
quotas:
|
||||
- name: test_project
|
||||
cores: 2
|
||||
ram: 4096
|
||||
ports: 10
|
||||
|
||||
- name: devstack
|
||||
servers:
|
||||
|
@ -61,6 +61,14 @@
|
||||
- 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
|
||||
|
Loading…
Reference in New Issue
Block a user