|
65 | 65 | environment: |
66 | 66 | KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
67 | 67 | delegate_to: localhost |
68 | | - when: cifmw_openshift_kubeconfig is defined |
| 68 | + when: |
| 69 | + - cifmw_openshift_kubeconfig is defined |
| 70 | + - swift_endpoints_count.stdout == "0" |
69 | 71 | ansible.builtin.command: "oc -n {{ cifmw_cephadm_ns }} rsh openstackclient openstack {{ item.os_command }} show {{ item.os_command_object }} -c id -f value" |
70 | 72 | register: all_uuids |
71 | 73 | loop: |
|
84 | 86 | - cifmw_cephadm_certificate | length > 0 |
85 | 87 | - cifmw_cephadm_key | length > 0 |
86 | 88 |
|
| 89 | +- name: Update Swift endpoints if exists |
| 90 | + delegate_to: localhost |
| 91 | + when: |
| 92 | + - cifmw_openshift_kubeconfig is defined |
| 93 | + - not swift_in_ctlplane.stdout | bool |
| 94 | + - swift_endpoints_count.stdout != "0" |
| 95 | + block: |
| 96 | + - name: Get UUID for Swift 'public' endpoint |
| 97 | + environment: |
| 98 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 99 | + ansible.builtin.shell: | |
| 100 | + set -euo pipefail |
| 101 | + oc exec -t openstackclient -- \ |
| 102 | + openstack endpoint list -f json | \ |
| 103 | + jq -r '.[] | select(.["Service Name"] == "swift" and .Interface == "public") | .ID' |
| 104 | + register: uuid_swift_public_ep |
| 105 | + changed_when: false |
| 106 | + |
| 107 | + - name: Get UUID for Swift 'internal' endpoint |
| 108 | + environment: |
| 109 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 110 | + ansible.builtin.shell: | |
| 111 | + set -euo pipefail |
| 112 | + oc exec -t openstackclient -- \ |
| 113 | + openstack endpoint list -f json | \ |
| 114 | + jq -r '.[] | select(.["Service Name"] == "swift" and .Interface == "internal") | .ID' |
| 115 | + register: uuid_swift_internal_ep |
| 116 | + changed_when: false |
| 117 | + |
| 118 | + - name: Update Swift endpoints url |
| 119 | + cifmw.general.ci_script: |
| 120 | + extra_args: |
| 121 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 122 | + output_dir: "/home/zuul/ci-framework-data/artifacts" |
| 123 | + script: |- |
| 124 | + oc -n {{ cifmw_cephadm_ns }} rsh openstackclient \ |
| 125 | + openstack endpoint set \ |
| 126 | + --url {{ cifmw_cephadm_urischeme }}://{{ ( |
| 127 | + cifmw_external_dns_vip_ext.values() | first |
| 128 | + if cifmw_external_dns_vip_ext is defined |
| 129 | + else cifmw_cephadm_rgw_vip | ansible.utils.ipaddr('address') |
| 130 | + ) }}:8080/swift/v1/AUTH_%\(tenant_id\)s \ |
| 131 | + {{ uuid_swift_public_ep.stdout }} |
| 132 | + oc -n {{ cifmw_cephadm_ns }} rsh openstackclient \ |
| 133 | + openstack endpoint set \ |
| 134 | + --url {{ cifmw_cephadm_urischeme }}://{{ ( |
| 135 | + cifmw_external_dns_vip_int.values() | first |
| 136 | + if cifmw_external_dns_vip_int is defined |
| 137 | + else cifmw_cephadm_rgw_vip | ansible.utils.ipaddr('address') |
| 138 | + ) }}:8080/swift/v1/AUTH_%\(tenant_id\)s \ |
| 139 | + {{ uuid_swift_internal_ep.stdout }} |
| 140 | +
|
87 | 141 | - name: Configure object store to use rgw |
88 | 142 | cifmw.general.ci_script: |
89 | 143 | extra_args: |
|
0 commit comments