|
| 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