openstack-ansible-os_cinder/tasks/cinder_qos.yml
Dmitriy Rabotyagov 8413941eaa Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/888223
Change-Id: I671cc35a055b35fb249ad3054c45ec65f2b54ab4
2023-07-14 12:58:19 +00:00

55 lines
2.3 KiB
YAML

---
# Copyright 2016, Walmart Stores, 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: Add in cinder qos types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \
--consumer {{ item.options.consumer }}\
{% for k, v in item.options.items() %} --property {{ k }}={{ v }}{% endfor %}
args:
executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}"
delegate_to: "{{ cinder_service_setup_host }}"
changed_when: false
tags:
- cinder-qos
- name: Associate qos types to volume types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
{% for vtype in item.cinder_volume_types %}
if {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }}
fi
{% endfor %}
args:
executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}"
changed_when: false
delegate_to: "{{ cinder_service_setup_host }}"
when:
- item.cinder_volume_types is defined
tags:
- cinder-qos
- cinder-qos-associate