|
20 | 20 | ansible.builtin.shell: | |
21 | 21 | {{ shell_header }} |
22 | 22 | {{ oc_header }} |
23 | | - oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch }}' |
| 23 | + if {{ enable_federation | default(false) | lower }} == true; then |
| 24 | + oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch_federation }}' |
| 25 | + else |
| 26 | + oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch }}' |
| 27 | + fi |
24 | 28 |
|
25 | 29 | - name: wait for Keystone to start up |
26 | 30 | ansible.builtin.shell: | |
|
74 | 78 | ${BASH_ALIASES[openstack]} service list | awk "/ $service /{ print \$2; }" | xargs -r ${BASH_ALIASES[openstack]} service delete || true |
75 | 79 | done |
76 | 80 |
|
| 81 | +- name: Ensure Keycloak CA secret exists when federation enabled |
| 82 | + when: enable_federation | default(false) | bool |
| 83 | + ansible.builtin.shell: | |
| 84 | + {{ shell_header }} |
| 85 | + {{ oc_header }} |
| 86 | +
|
| 87 | + if ! oc get secret keycloakca >/dev/null 2>&1; then |
| 88 | + oc create secret generic keycloakca --from-file=KeyCloakCA={{ federation_ingress_ca_path }} |
| 89 | + fi |
| 90 | +
|
| 91 | +- name: Ensure Keystone httpd override secret exists when federation enabled |
| 92 | + when: |
| 93 | + - enable_federation | default(false) | bool |
| 94 | + ansible.builtin.shell: | |
| 95 | + {{ shell_header }} |
| 96 | + {{ oc_header }} |
| 97 | +
|
| 98 | + cat <<EOF | oc apply -f - |
| 99 | + apiVersion: v1 |
| 100 | + kind: Secret |
| 101 | + metadata: |
| 102 | + name: keystone-httpd-override |
| 103 | + namespace: openstack |
| 104 | + type: Opaque |
| 105 | + stringData: |
| 106 | + federation.conf: | |
| 107 | + OIDCClaimPrefix "{{ cifmw_keystone_oidc_claim_prefix }}" |
| 108 | + OIDCResponseType "{{ cifmw_keystone_oidc_response_type }}" |
| 109 | + OIDCScope "{{ cifmw_keystone_oidc_scope }}" |
| 110 | + OIDCClaimDelimiter "{{ cifmw_keystone_oidc_claim_delimiter }}" |
| 111 | + OIDCPassUserInfoAs "{{ cifmw_keystone_oidc_pass_user_info_as }}" |
| 112 | + OIDCPassClaimsAs "{{ cifmw_keystone_oidc_pass_claims_as }}" |
| 113 | + OIDCProviderMetadataURL "{{ cifmw_keystone_oidc_provider_metadata_url }}" |
| 114 | + OIDCClientID "{{ cifmw_keystone_oidc_client_id }}" |
| 115 | + OIDCClientSecret "{{ cifmw_keystone_oidc_client_secret }}" |
| 116 | + OIDCCryptoPassphrase "{{ cifmw_keystone_oidc_crypto_passphrase }}" |
| 117 | + OIDCOAuthClientID "{{ cifmw_keystone_oidc_oauth_client_id }}" |
| 118 | + OIDCOAuthClientSecret "{{ cifmw_keystone_oidc_oauth_client_secret }}" |
| 119 | + OIDCOAuthIntrospectionEndpoint "{{ cifmw_keystone_oidc_oauth_introspection_endpoint }}" |
| 120 | + OIDCRedirectURI "{{ cifmw_federation_keystone_url }}/v3/auth/OS-FEDERATION/identity_providers/{{ cifmw_keystone_oidc_provider_name }}/protocols/openid/websso/" |
| 121 | + LogLevel debug |
| 122 | +
|
| 123 | + <LocationMatch "/v3/auth/OS-FEDERATION/identity_providers/{{ cifmw_keystone_oidc_provider_name }}/protocols/openid/websso"> |
| 124 | + AuthType "openid-connect" |
| 125 | + Require valid-user |
| 126 | + </LocationMatch> |
| 127 | +
|
| 128 | + <Location "/v3/OS-FEDERATION/identity_providers/{{ cifmw_keystone_oidc_provider_name }}/protocols/openid/auth"> |
| 129 | + AuthType oauth20 |
| 130 | + Require valid-user |
| 131 | + </Location> |
| 132 | +
|
| 133 | + <LocationMatch "/v3/auth/OS-FEDERATION/websso/openid"> |
| 134 | + AuthType "openid-connect" |
| 135 | + Require valid-user |
| 136 | + </LocationMatch> |
| 137 | + EOF |
| 138 | +
|
77 | 139 | - name: Print session test token |
78 | 140 | ansible.builtin.debug: |
79 | 141 | var: before_adoption_token |
|
92 | 154 | fi |
93 | 155 | register: adoption_token_result |
94 | 156 |
|
| 157 | +- name: Verify that pre-adoption OIDC token still works |
| 158 | + when: |
| 159 | + - enable_federation | default(false) | bool |
| 160 | + - before_adoption_oidc_token is defined |
| 161 | + - before_adoption_oidc_token.stdout is defined |
| 162 | + ansible.builtin.shell: |
| 163 | + cmd: | |
| 164 | + {{ shell_header }} |
| 165 | + {{ oc_header }} |
| 166 | +
|
| 167 | + 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" |
| 168 | +
|
| 169 | + ${BASH_ALIASES[openstack]} token issue -f json |
| 170 | + register: adoption_oidc_token_result |
| 171 | + |
95 | 172 | - name: Print credentials test token |
96 | 173 | ansible.builtin.debug: |
97 | 174 | var: before_adoption_token |
|
0 commit comments