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