Use global service variables

Instead of overriding each service separatelly it might make
sense for deployers to define some higher level variable that
will be used first or fallback to default variable.

Change-Id: If14b89d4c795ba7e129af6a2f4b4bcbc10208986
This commit is contained in:
Dmitriy Rabotyagov 2021-01-05 19:09:06 +02:00
parent 00a38c6584
commit d9bfa963e8
4 changed files with 19 additions and 17 deletions

View File

@ -13,10 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Set the package install state for distribution and pip packages
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
cinder_package_state: "latest"
cinder_pip_package_state: "latest"
cinder_package_state: "{{ package_state | default('latest') }}"
# Set the host which will execute the shade modules
# for the service setup. The host must already have
@ -25,7 +24,7 @@ cinder_service_setup_host: "{{ openstack_service_setup_host | default('localhost
cinder_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((cinder_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
# Set installation method.
cinder_install_method: "source"
cinder_install_method: "{{ service_install_method | default('source') }}"
cinder_venv_python_executable: "{{ openstack_venv_python_executable | default('python2') }}"
cinder_git_repo: https://opendev.org/openstack/cinder
@ -42,10 +41,10 @@ cinder_venv_tag: "{{ venv_tag | default('untagged') }}"
cinder_bin: "{{ _cinder_bin }}"
# Enable/Disable Barbican
cinder_barbican_enabled: False
cinder_barbican_enabled: "{{ (groups['barbican_all'] is defined) and (groups['barbican_all'] | length > 0) }}"
# Enable/Disable Ceilometer
cinder_ceilometer_enabled: False
cinder_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
# Time period for which to generate volume usages. The options are hour, day,
# month, or year. (string value)
@ -71,7 +70,7 @@ cinder_galera_user: cinder
cinder_galera_database: cinder
cinder_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
cinder_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
cinder_galera_port: 3306
cinder_galera_port: "{{ galera_port | default('3306') }}"
## Oslo Messaging
@ -128,9 +127,6 @@ cinder_service_admin_username: "cinder"
## Cinder API's enabled
cinder_enable_v2_api: true
## Cinder API check cert validation
cinder_service_internaluri_insecure: false
## Cinder api service type and data
cinder_service_name: cinder
cinder_service_project_domain_id: default
@ -138,7 +134,7 @@ cinder_service_user_domain_id: default
cinder_service_user_name: cinder
cinder_service_project_name: service
cinder_service_role_name: admin
cinder_service_region: RegionOne
cinder_service_region: "{{ service_region | default('RegionOne') }}"
cinder_service_description: "Cinder Volume Service"
cinder_service_port: 8776
cinder_service_proto: http
@ -289,7 +285,7 @@ cinder_active_active_cluster_name: ceph
# Comma separated list of Glance API servers
cinder_glance_api_servers: "{{ (glance_service_internalurl | default('http://localhost')) | urlsplit('scheme') ~ '://' ~ (glance_service_internalurl | default('http://localhost')) | urlsplit('netloc') }}"
cinder_service_in_ldap: false
cinder_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}"
# Common pip packages
cinder_pip_packages:

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
Variable ``cinder_service_internaluri_insecure`` has been replaced with
``keystone_service_internaluri_insecure`` that is used across all roles
for the exact same purpose.

View File

@ -17,7 +17,7 @@
uri:
url: "{{ cinder_service_internaluri }}"
status_code: 200,300
validate_certs: "{{ cinder_service_internaluri_insecure | bool }}"
validate_certs: "{{ keystone_service_internaluri_insecure | bool }}"
register: api_status
until: api_status is success
retries: 10
@ -39,7 +39,7 @@
- name: Add in cinder devices types
shell: |
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ item.key }}"
fi
@ -52,7 +52,7 @@
- name: Add extra cinder volume types
shell: |
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{% for evtype in item.value.extra_volume_types %}
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ evtype }}"

View File

@ -16,7 +16,7 @@
- name: Add in cinder qos types
shell: |
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \
--consumer {{ item.options.consumer }}\
@ -32,7 +32,7 @@
- name: Associate qos types to volume types
shell: |
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{% for vtype in item.cinder_volume_types %}
if {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }}