Skip to content

Commit ca12642

Browse files
author
Manoj Katari
committed
Support IPv6 addresses in Ceph RGW object storage configuration
Add proper IPv6 URL formatting for Swift endpoints when configuring Ceph RGW as the object storage backend. The ipwrap filter ensures IPv6 addresses are properly enclosed in brackets while leaving IPv4 addresses unchanged, preventing URL parsing errors. Also adds validation to ensure ceph_rgw_virtual_ips_list is not empty before attempting to use it, providing clear error messaging for configuration issues.
1 parent 673bf72 commit ca12642

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/roles/ceph_migrate/tasks/configure_object.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,25 @@
6161
- {os_command: 'role', os_command_object: 'swiftoperator'}
6262
- {os_command: 'project', os_command_object: 'service'}
6363

64+
# Validate that ceph_rgw_virtual_ips_list is not empty
65+
- name: Validate Ceph RGW IP list is not empty
66+
ansible.builtin.fail:
67+
msg: "ceph_rgw_virtual_ips_list is empty or undefined. Please ensure Ceph RGW virtual IPs are configured."
68+
when:
69+
- ceph_rgw_virtual_ips_list is not defined or ceph_rgw_virtual_ips_list | length == 0
70+
71+
# This task will wrap the ip with [] in case of ipv6, for ipv4 ip is used as it is.
72+
- name: Extract IP and wrap it in case of IPV6 url
73+
ansible.builtin.set_fact:
74+
ceph_rgw_url: "{{ (ceph_rgw_virtual_ips_list[0] | ansible.utils.ipaddr('address')) | ansible.utils.ipwrap }}"
75+
6476
- name: Configure swift endpoints to use rgw
6577
ansible.builtin.shell: |
6678
{{ shell_header }}
6779
alias openstack="oc exec -t openstackclient -- openstack"
6880
6981
${BASH_ALIASES[openstack]} role add --user {{ all_uuids.results.0.stdout }} --project {{ all_uuids.results.7.stdout }} {{ all_uuids.results.2.stdout }}
7082
${BASH_ALIASES[openstack]} role add --user {{ all_uuids.results.0.stdout }} --project {{ all_uuids.results.7.stdout }} {{ all_uuids.results.3.stdout }}
71-
${BASH_ALIASES[openstack]} endpoint create --region regionOne {{ all_uuids.results.1.stdout }} public http://{{ ceph_rgw_virtual_ips_list[0] | ansible.utils.ipaddr('address') }}:8080/swift/v1/AUTH_%\(tenant_id\)s
72-
${BASH_ALIASES[openstack]} endpoint create --region regionOne {{ all_uuids.results.1.stdout }} internal http://{{ ceph_rgw_virtual_ips_list[0] | ansible.utils.ipaddr('address') }}:8080/swift/v1/AUTH_%\(tenant_id\)s
83+
${BASH_ALIASES[openstack]} endpoint create --region regionOne {{ all_uuids.results.1.stdout }} public http://{{ ceph_rgw_url }}:8080/swift/v1/AUTH_%\(tenant_id\)s
84+
${BASH_ALIASES[openstack]} endpoint create --region regionOne {{ all_uuids.results.1.stdout }} internal http://{{ ceph_rgw_url }}:8080/swift/v1/AUTH_%\(tenant_id\)s
7385
${BASH_ALIASES[openstack]} role add --project {{ all_uuids.results.4.stdout }} --user {{ all_uuids.results.5.stdout }} {{ all_uuids.results.6.stdout }}

0 commit comments

Comments
 (0)