|
86 | 86 | ADMIN_USERNAME: "{{ cifmw_federation_keycloak_admin_username | b64encode }}" |
87 | 87 | ADMIN_PASSWORD: "{{ cifmw_federation_keycloak_admin_password | b64encode }}" |
88 | 88 |
|
89 | | -- name: Read federation sso template |
90 | | - ansible.builtin.template: |
91 | | - src: sso.yaml.j2 |
92 | | - dest: "{{ [ ansible_user_dir, 'ci-framework-data', 'tmp', 'sso.yaml' ] | path_join }}" |
93 | | - mode: "0644" |
| 89 | +- name: Install federation Keycloak instance |
| 90 | + kubernetes.core.k8s: |
| 91 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 92 | + state: present |
| 93 | + definition: |
| 94 | + apiVersion: keycloak.org/v1alpha1 |
| 95 | + kind: Keycloak |
| 96 | + metadata: |
| 97 | + name: sso |
| 98 | + namespace: "{{ cifmw_federation_keycloak_namespace }}" |
| 99 | + labels: |
| 100 | + app: sso |
| 101 | + spec: |
| 102 | + instances: 1 |
| 103 | + externalAccess: |
| 104 | + enabled: true |
94 | 105 |
|
95 | | -- name: Install federation sso pod |
96 | | - environment: |
97 | | - KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
98 | | - PATH: "{{ cifmw_path }}" |
99 | | - ansible.builtin.command: |
100 | | - cmd: "oc apply -n {{ cifmw_federation_keycloak_namespace }} -f {{ [ ansible_user_dir, 'ci-framework-data', 'tmp', 'sso.yaml' ] | path_join }}" |
| 106 | +- name: Wait for Keycloak service to be created |
| 107 | + kubernetes.core.k8s_info: |
| 108 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 109 | + api_version: v1 |
| 110 | + kind: Service |
| 111 | + name: keycloak |
| 112 | + namespace: "{{ cifmw_federation_keycloak_namespace }}" |
| 113 | + register: keycloak_service |
| 114 | + until: keycloak_service.resources | length > 0 |
| 115 | + retries: 30 |
| 116 | + delay: 10 |
| 117 | + |
| 118 | +- name: Create Route for Keycloak |
| 119 | + kubernetes.core.k8s: |
| 120 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 121 | + state: present |
| 122 | + definition: |
| 123 | + apiVersion: route.openshift.io/v1 |
| 124 | + kind: Route |
| 125 | + metadata: |
| 126 | + name: keycloak |
| 127 | + namespace: "{{ cifmw_federation_keycloak_namespace }}" |
| 128 | + spec: |
| 129 | + host: "keycloak-{{ cifmw_federation_keycloak_namespace }}.{{ cifmw_federation_domain }}" |
| 130 | + port: |
| 131 | + targetPort: 8443 |
| 132 | + tls: |
| 133 | + termination: passthrough |
| 134 | + to: |
| 135 | + kind: Service |
| 136 | + name: keycloak |
| 137 | + weight: 100 |
| 138 | + wildcardPolicy: None |
101 | 139 |
|
102 | 140 | - name: Grant privileged SCC to namespace default serviceaccount for Keycloak |
103 | 141 | environment: |
|
120 | 158 | block: | |
121 | 159 | {{ hostvars['crc'].ansible_host }} api.crc.testing |
122 | 160 | {{ hostvars['crc'].ansible_host }} oauth-openshift.apps-crc.testing |
123 | | - {{ hostvars['crc'].ansible_host }} keycloak-openstack.apps-crc.testing |
| 161 | + {{ hostvars['crc'].ansible_host }} keycloak-{{ cifmw_federation_operator_namespace }}.{{ cifmw_federation_domain }} |
124 | 162 | when: cifmw_federation_deploy_type == "crc" |
125 | 163 |
|
126 | 164 | - name: Wait for SSO pod to be avalable |
|
0 commit comments