openstack-ansible-os_keystone/vars/main.yml
Dmitriy Rabotyagov bfd4651fe5 Ensure that first/last host detection is deterministic
With ansible-core 2.16 a breaking changes landed [1] to some filters
making their result returned in arbitrary order. With that, we were
relying on them to always return exactly same ordered lists.

With that we need to ensure that we still have determenistic behaviour
where this is important.

[1] https://github.com/ansible/ansible/issues/82554

Change-Id: I76fd03a9584b5999af6cb247f8a3f67d5343b055
2024-07-19 11:01:26 +02:00

80 lines
2.9 KiB
YAML

---
# Copyright 2018, Rackspace US, 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.
keystone_core_files: []
uwsgi_keystone_services: |-
{% set services = {} %}
{% for key, value in keystone_services.items() %}
{% if (value['group'] in group_names) and
(('condition' not in value) or ('condition' in value and value['condition']))
and ('wsgi_app' in value and value['wsgi_app']) %}
{% set _ = value.update(
{
'wsgi_venv': (keystone_install_method == 'source') | ternary(keystone_bin | dirname, None),
'uwsgi_uid': keystone_system_user_name,
'uwsgi_guid': keystone_system_group_name,
'uwsgi_processes': keystone_wsgi_processes,
'uwsgi_threads': keystone_wsgi_threads,
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
_keystone_is_first_play_host: >-
{{
(keystone_services['keystone-wsgi-public']['group'] in group_names and
inventory_hostname == ((groups[keystone_services['keystone-wsgi-public']['group']] | select('in', ansible_play_hosts)) | list)[0]) | bool
}}
_keystone_is_last_play_host: >-
{{
(keystone_services['keystone-wsgi-public']['group'] in group_names and
inventory_hostname == ((groups[keystone_services['keystone-wsgi-public']['group']] | select('in', ansible_play_hosts)) | list)[-1]) | bool
}}
_keystone_oslomsg_rpc_vhost_conf: >-
{{
(keystone_oslomsg_rpc_vhost is string) | ternary(
keystone_oslomsg_rpc_vhost, keystone_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_keystone_oslomsg_notify_vhost_conf: >-
{{
(keystone_oslomsg_notify_vhost is string) | ternary(
keystone_oslomsg_notify_vhost, keystone_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_keystone_cache_backend_map:
dogpile:
- oslo_cache.memcache_pool
- dogpile.cache.pymemcache
- dogpile.cache.memcached
- dogpile.cache.bmemcached
mongo:
- oslo_cache.mongo
etcd3gw:
- oslo_cache.etcd3gw
_keystone_cache_backend_package: |-
{% set oslo = namespace(backend='dogpile') %}
{% for key, value in _keystone_cache_backend_map.items() %}
{% if keystone_cache_backend in value %}
{% set oslo.backend = key %}
{%- endif %}
{%- endfor %}
oslo.cache[{{ oslo.backend }}]