Modify RGW client format

With changes to config_template module that restored usage of {% raw %} tags [1]
renderring of mapping keys, if they're defined as variables, was broken.

Ansible, by design [2], does not render mapping keys. Moreover, it was not
working as intended anyway, since renderring happened in post-copy stage
so same records were not merged together, which resulted in #1812245

As such behaviour is expected by Ansible design, instead of adding some
workaround in config_template module, I suggest working around issue
by defining troublesome mapping with Jinja, that will allow it to render properly.

[1] https://review.opendev.org/c/openstack/ansible-config_template/+/881887
[2] https://github.com/ansible/ansible/issues/17324#issuecomment-685102595

Closes-Bug: #2048036
Related-Bug: #1812245
Change-Id: I8a32736239c6326d817c620451799c13d5d8938c
(cherry picked from commit 4203aa26c6)
This commit is contained in:
Dmitriy Rabotyagov 2024-01-04 13:09:39 +01:00 committed by Dmitriy Rabotyagov
parent 6567efc355
commit dbc265ce59
2 changed files with 55 additions and 17 deletions

View File

@ -1,19 +1,23 @@
---
ceph_conf_overrides_rgw:
"client.rgw.{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] }}.rgw0":
# OpenStack integration with Keystone
rgw_keystone_url: "{{ keystone_service_adminuri }}"
rgw_keystone_api_version: 3
rgw_keystone_admin_user: "{{ radosgw_admin_user }}"
rgw_keystone_admin_password: "{{ radosgw_admin_password }}"
rgw_keystone_admin_project: "{{ radosgw_admin_tenant }}"
rgw_keystone_admin_domain: default
rgw_keystone_accepted_roles: 'member, admin, swiftoperator'
rgw_keystone_implicit_tenants: 'true'
rgw_swift_account_in_url: 'true'
rgw_swift_versioning_enabled: 'true'
rgw_enable_apis: swift
# For S3 support, update/add below rows
# rgw_enable_apis: 'swift, s3'
# rgw_s3_auth_use_keystone: 'true'
ceph_conf_overrides_rgw: |-
{{
{
'client.rgw.' ~ hostvars[inventory_hostname]['ansible_facts']['hostname'] ~ '.rgw0': {
'rgw_keystone_url': keystone_service_adminuri,
'rgw_keystone_api_version': 3,
'rgw_keystone_admin_user': radosgw_admin_user,
'rgw_keystone_admin_password': radosgw_admin_password,
'rgw_keystone_admin_project': radosgw_admin_tenant,
'rgw_keystone_admin_domain': 'default',
'rgw_keystone_accepted_roles': 'member, admin, swiftoperator',
'rgw_keystone_implicit_tenants': 'true',
'rgw_swift_account_in_url': 'true',
'rgw_swift_versioning_enabled': 'true',
'rgw_enable_apis': 'swift'
}
}
}}
# For S3 support, update/add above rows
# 'rgw_enable_apis': 'swift, s3'
# 'rgw_s3_auth_use_keystone': 'true'

View File

@ -0,0 +1,34 @@
---
issues:
- |
With recent changes to config_template module, it is not possible
anymore to have variables as dictionary keys in overrides. Example below
will not be renderred properly:
.. code-block:: yaml
config_overrides:
"{{ inventory_hostname }}":
cruel: world
This limitation boils down to Ansible design and will be true for any other
module as well.
In order to overcome it, you can transform the dictionary to a Jinja2 format:
.. code-block:: yaml
config_overrides: |-
{{
{
inventory_hostname: {
'cruel': 'world'
}
}
}}
fixes:
- |
Fixes format of ``ceph_conf_overrides_rgw`` variable by converting override
dictionary to Jinja2 format to workaround Ansible limitation on usage of
variables as keys in dictionary.