Skip to content

Commit 8796750

Browse files
committed
Add Swift RGW configuration playbook for post-adoption setup
This commit adds support for configuring Swift object storage to use Ceph RGW after adoption is complete. The configuration requires the adopted OpenShift environment to be running with Keystone services available. Changes: - Add configure_swift_rgw.yaml playbook with three phases: 1. Extract Swift password and Keystone endpoint from OpenShift 2. Configure Ceph RGW with Keystone integration settings 3. Configure Swift endpoints to use RGW backend - Add test-configure-object Makefile target to invoke the playbook - Playbook uses variables extracted at runtime from the live OpenShift environment (ceph_keystone_ep, ceph_keystone_swift_pwd, and ceph_rgw_virtual_ips_list) which are passed to the ceph_migrate role
1 parent 92ed30a commit 8796750

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ test-with-ironic: ## Launch test suite with Ironic
9595
mkdir -p tests/logs
9696
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_SECRETS) -e @$(TEST_VARS) $(TEST_ARGS) tests/playbooks/test_with_ironic.yaml 2>&1 | tee $(TEST_OUTFILE)
9797

98+
test-configure-object: TEST_OUTFILE ?= tests/logs/test_configure_object_out_$(shell date +%FT%T%Z).log
99+
test-configure-object: ## Configure Swift object store to use Ceph RGW
100+
mkdir -p tests/logs
101+
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_SECRETS) -e @$(TEST_VARS) $(TEST_ARGS) tests/playbooks/configure_swift_rgw.yaml 2>&1 | tee $(TEST_OUTFILE)
102+
98103
##@ DOCS
99104

100105
docs-dependencies: .bundle
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
- name: Build Ceph RGW overrides for configure_object
3+
hosts: localhost
4+
gather_facts: false
5+
tasks:
6+
- name: Extract Swift password from OpenShift secret
7+
ansible.builtin.shell: |
8+
oc get secret osp-secret -o json | jq -r '.data.SwiftPassword' | base64 -d
9+
register: swift_password_result
10+
changed_when: false
11+
12+
- name: Get keystone-internal service details
13+
ansible.builtin.shell: "oc get svc keystone-internal -o json | jq -r '.status.loadBalancer.ingress[0].ip'"
14+
register: keystone_svc_lb_ip
15+
changed_when: false
16+
17+
- name: Construct Keystone service URL
18+
ansible.builtin.set_fact:
19+
keystone_url: "{{ keystone_protocol | default('http') }}://{{ keystone_svc_lb_ip.stdout | ansible.utils.ipwrap }}:5000"
20+
when: keystone_svc_lb_ip.stdout | length > 0
21+
22+
- name: Set variables for Ceph RGW configuration
23+
ansible.builtin.set_fact:
24+
ceph_keystone_ep: "{{ keystone_url }}"
25+
ceph_keystone_swift_pwd: "{{ swift_password_result.stdout }}"
26+
27+
- name: Configure Ceph RGW Keystone settings
28+
hosts: "{{ groups['ceph'][0] | default([]) }}"
29+
gather_facts: true
30+
vars:
31+
ceph_keystone_ep: "{{ hostvars['localhost']['ceph_keystone_ep'] }}"
32+
ceph_keystone_swift_pwd: "{{ hostvars['localhost']['ceph_keystone_swift_pwd'] }}"
33+
tasks:
34+
- name: Configure Ceph RGW Keystone settings
35+
ansible.builtin.shell: |
36+
sudo cephadm shell -- ceph config set global rgw_keystone_url {{ ceph_keystone_ep }}
37+
sudo cephadm shell -- ceph config set global rgw_keystone_admin_password {{ ceph_keystone_swift_pwd }}
38+
# refresh rgw after updating keystone rgw config
39+
sudo cephadm shell -- ceph orch redeploy rgw.rgw
40+
changed_when: true
41+
42+
- name: Configure swift object store
43+
hosts: localhost
44+
gather_facts: true
45+
vars:
46+
shell_header: "set -euo pipefail"
47+
#ceph_rgw_vip: "2620:cf:cf:cccc::2/64" (ipv6) or "172.18.0.2/24" (ipv4)
48+
tasks:
49+
- name: Set Ceph RGW virtual IPs list
50+
ansible.builtin.set_fact:
51+
ceph_rgw_virtual_ips_list:
52+
- "{{ ceph_rgw_vip }}"
53+
54+
- name: Configure swift endpoints to use rgw
55+
ansible.builtin.import_role:
56+
name: ceph_migrate
57+
tasks_from: configure_object

0 commit comments

Comments
 (0)