Skip to content

Commit 83fb0e3

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 a10bf45 commit 83fb0e3

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
- name: Configure Swift to use Ceph RGW
3+
hosts: localhost
4+
gather_facts: true
5+
vars:
6+
shell_header: "set -euo pipefail"
7+
rgw_service_name: "rgw.rgw"
8+
tasks:
9+
- name: Extract Swift password from OpenShift secret
10+
ansible.builtin.shell: |
11+
oc get secret osp-secret -o json | jq -r '.data.SwiftPassword' | base64 -d
12+
register: swift_password_result
13+
changed_when: false
14+
15+
- name: Get keystone-internal service details
16+
ansible.builtin.shell: "oc get svc keystone-internal -o json | jq -r '.status.loadBalancer.ingress[0].ip'"
17+
register: keystone_svc_lb_ip
18+
changed_when: false
19+
20+
- name: Construct Keystone service URL
21+
ansible.builtin.set_fact:
22+
keystone_url: "{{ keystone_protocol | default('http') }}://{{ keystone_svc_lb_ip.stdout | ansible.utils.ipwrap }}:5000"
23+
when: keystone_svc_lb_ip.stdout | length > 0
24+
25+
- name: Set variables for Ceph RGW configuration
26+
ansible.builtin.set_fact:
27+
ceph_keystone_ep: "{{ keystone_url }}"
28+
ceph_keystone_swift_pwd: "{{ swift_password_result.stdout }}"
29+
30+
- name: Configure Ceph RGW Keystone settings
31+
ansible.builtin.shell: |
32+
sudo cephadm shell -- ceph config set global rgw_keystone_url {{ ceph_keystone_ep }}
33+
sudo cephadm shell -- ceph config set global rgw_keystone_admin_password {{ ceph_keystone_swift_pwd }}
34+
# refresh rgw after updating keystone rgw config
35+
sudo cephadm shell -- ceph orch redeploy {{ rgw_service_name }}
36+
delegate_to: "{{ groups['ceph'][0] }}"
37+
changed_when: true
38+
39+
- name: Configure swift endpoints to use rgw
40+
ansible.builtin.import_role:
41+
name: ceph_migrate
42+
tasks_from: configure_object

0 commit comments

Comments
 (0)