Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ test-with-ironic: ## Launch test suite with Ironic
mkdir -p tests/logs
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)

test-configure-object: TEST_OUTFILE ?= tests/logs/test_configure_object_out_$(shell date +%FT%T%Z).log
test-configure-object: ## Configure Swift object store to use Ceph RGW
mkdir -p tests/logs
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)

##@ DOCS

docs-dependencies: .bundle
Expand Down
39 changes: 39 additions & 0 deletions tests/playbooks/configure_swift_rgw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
- name: Configure Swift to use Ceph RGW
hosts: localhost
gather_facts: true
vars:
shell_header: "set -euo pipefail"
rgw_service_name: "rgw.rgw"
tasks:
- name: Extract Swift password from OpenShift secret
ansible.builtin.shell: |
oc get secret osp-secret -o json | jq -r '.data.SwiftPassword' | base64 -d
register: swift_password_result
changed_when: false
failed_when: swift_password_result.stdout | length == 0

- name: Get keystone-internal service details
ansible.builtin.shell: "oc get svc keystone-internal -o json | jq -r '.status.loadBalancer.ingress[0].ip'"
register: keystone_svc_lb_ip
changed_when: false
failed_when: keystone_svc_lb_ip.stdout | length == 0

- name: Set variables for Ceph RGW configuration
ansible.builtin.set_fact:
ceph_keystone_ep: "{{ keystone_protocol | default('http') }}://{{ keystone_svc_lb_ip.stdout | ansible.utils.ipwrap }}:5000"
ceph_keystone_swift_pwd: "{{ swift_password_result.stdout }}"

- name: Configure Ceph RGW Keystone settings
ansible.builtin.shell: |
sudo cephadm shell -- ceph config set global rgw_keystone_url {{ ceph_keystone_ep }}
sudo cephadm shell -- ceph config set global rgw_keystone_admin_password {{ ceph_keystone_swift_pwd }}
# refresh rgw after updating keystone rgw config
sudo cephadm shell -- ceph orch redeploy {{ rgw_service_name }}
delegate_to: "{{ groups['ceph'][0] }}"
changed_when: true

- name: Configure swift endpoints to use rgw
ansible.builtin.import_role:
name: ceph_migrate
tasks_from: configure_object