|
194 | 194 | fi |
195 | 195 | register: adoption_token_result |
196 | 196 |
|
197 | | -- name: Verify that pre-adoption OIDC token still works |
| 197 | +- name: Verify that OIDC federation still works |
198 | 198 | when: |
199 | 199 | - enable_federation | default(false) | bool |
200 | | - - before_adoption_oidc_token is defined |
201 | | - - before_adoption_oidc_token.stdout is defined |
202 | | - ansible.builtin.shell: |
203 | | - cmd: | |
204 | | - {{ shell_header }} |
205 | | - {{ oc_header }} |
206 | | -
|
207 | | - alias openstack="oc exec -t openstackclient -- env -u OS_CLOUD - OS_AUTH_URL={{ auth_url }} OS_AUTH_TYPE=v3oidcaccesstoken OS_ACCESS_TOKEN={{ before_adoption_oidc_token.stdout }} openstack" |
208 | | -
|
209 | | - ${BASH_ALIASES[openstack]} token issue -f json |
210 | | - register: adoption_oidc_token_result |
| 200 | + block: |
| 201 | + - name: Generate OIDC token after adoption |
| 202 | + ansible.builtin.shell: | |
| 203 | + {{ shell_header }} |
| 204 | + {{ oc_header }} |
| 205 | +
|
| 206 | + oc exec openstackclient -- bash -c "cat > /tmp/oidc_cloudrc" <<'EOF' |
| 207 | + unset OS_CLOUD |
| 208 | + export OS_CACERT=/home/cloud-admin/full-ca-list.crt |
| 209 | + export OS_PROJECT_NAME="{{ cifmw_federation_project_name }}" |
| 210 | + export OS_PROJECT_DOMAIN_NAME="{{ cifmw_federation_domain }}" |
| 211 | + export OS_AUTH_URL="{{ cifmw_federation_keystone_url }}/v3" |
| 212 | + export OS_IDENTITY_API_VERSION=3 |
| 213 | + export OS_AUTH_PLUGIN=openid |
| 214 | + export OS_AUTH_TYPE=v3oidcpassword |
| 215 | + export OS_USERNAME="{{ cifmw_federation_keycloak_testuser1_username }}" |
| 216 | + export OS_PASSWORD="{{ cifmw_federation_keycloak_testuser1_password }}" |
| 217 | + export OS_IDENTITY_PROVIDER="{{ cifmw_federation_idp_name }}" |
| 218 | + export OS_CLIENT_ID="{{ cifmw_federation_keycloak_client_id }}" |
| 219 | + export OS_CLIENT_SECRET="{{ cifmw_federation_keycloak_client_secret }}" |
| 220 | + export OS_OPENID_SCOPE="openid profile email" |
| 221 | + export OS_PROTOCOL=openid |
| 222 | + export OS_ACCESS_TOKEN_TYPE=access_token |
| 223 | + export OS_DISCOVERY_ENDPOINT="{{ cifmw_federation_keycloak_url }}/auth/realms/{{ cifmw_federation_keycloak_realm }}/.well-known/openid-configuration" |
| 224 | + EOF |
| 225 | +
|
| 226 | + oc exec openstackclient -- bash -c "source /tmp/oidc_cloudrc && openstack token issue -f value -c id" |
| 227 | + register: oidc_token |
| 228 | + failed_when: oidc_token.rc != 0 or oidc_token.stdout == "" |
211 | 229 |
|
212 | 230 | - name: Print credentials test token |
213 | 231 | ansible.builtin.debug: |
214 | | - var: before_adoption_token |
| 232 | + var: oidc_token |
215 | 233 |
|
216 | 234 | - name: Verify that pre-adoption credential stills the same |
217 | 235 | ansible.builtin.shell: | |
|
0 commit comments