commit | author | age
|
16f23b
|
1 |
--- |
GH |
2 |
- name: set namespace |
|
3 |
set_fact: |
|
4 |
_namespace: "codeready-workspaces" |
|
5 |
|
|
6 |
- name: Create namespace for {{ _namespace }} |
|
7 |
k8s: |
|
8 |
state: present |
|
9 |
definition: "{{ lookup('template', role_path ~ '/templates/namespace.j2' ) | from_yaml }}" |
|
10 |
|
|
11 |
- name: Create OperatorGroup for the operators |
|
12 |
k8s: |
|
13 |
state: present |
ddd690
|
14 |
definition: "{{ lookup('template', role_path ~ '/templates/olm-operatorgroup/single-namespace.j2' ) | from_yaml }}" |
16f23b
|
15 |
|
GH |
16 |
- name: Create operator |
|
17 |
k8s: |
|
18 |
state: present |
|
19 |
namespace: "{{ _namespace }}" |
|
20 |
definition: "{{ lookup('file', role_path ~ '/files/codeready-workspaces/operator.yml' ) | from_yaml }}" |
|
21 |
|
|
22 |
- name: Wait until csv/{{ _crw_csv_version }} is Succeeded |
|
23 |
command: > |
|
24 |
oc get csv/{{ _crw_csv_version }} -o jsonpath='{.status.phase}' -n "{{ _namespace }}" |
|
25 |
register: crwcsv |
|
26 |
retries: "{{ _retry }}" |
|
27 |
delay: "{{ _delay }}" |
|
28 |
until: crwcsv.stdout == "Succeeded" |
|
29 |
|
|
30 |
- name: Check if Che cluster already exists (note; error can be ignored) |
|
31 |
command: > |
|
32 |
oc get CheCluster/codeready-workspaces -o jsonpath='{.metadata.name}' -n "{{ _namespace }}" |
|
33 |
register: che_cluster |
|
34 |
ignore_errors: true |
|
35 |
|
|
36 |
- name: Create Che Cluster |
|
37 |
k8s: |
|
38 |
state: present |
|
39 |
namespace: "{{ _namespace }}" |
|
40 |
definition: "{{ lookup('template', role_path ~ '/files/codeready-workspaces/cluster.yml' ) | from_yaml }}" |
|
41 |
when: che_cluster.stdout != "codeready-workspaces" |
|
42 |
|
|
43 |
- name: Wait until Che Cluster is Running |
|
44 |
command: > |
|
45 |
oc get CheCluster/codeready-workspaces -o jsonpath='{.status.cheClusterRunning}' -n "{{ _namespace }}" |
|
46 |
register: checluster |
|
47 |
retries: "{{ _retry }}" |
|
48 |
delay: "{{ _delay }}" |
|
49 |
until: checluster.stdout == "Available" |
|
50 |
|
|
51 |
- name: Get codeready route host |
|
52 |
command: > |
|
53 |
oc get route/codeready -o jsonpath='{.spec.host}' -n "{{ _namespace }}" |
|
54 |
register: che_route |
|
55 |
retries: "{{ _retry }}" |
|
56 |
delay: "{{ _delay }}" |
|
57 |
until: che_route.stdout != "" |
|
58 |
|
|
59 |
- name: Get keycloak route host |
|
60 |
command: > |
|
61 |
oc get route/keycloak -o jsonpath='{.spec.host}' -n "{{ _namespace }}" |
|
62 |
register: keycloak_route |
|
63 |
retries: "{{ _retry }}" |
|
64 |
delay: "{{ _delay }}" |
|
65 |
until: keycloak_route.stdout != "" |
|
66 |
|
|
67 |
- name: Wait for Che route to respond with 200 |
|
68 |
uri: |
|
69 |
url: "http://{{ che_route.stdout }}" |
|
70 |
method: GET |
|
71 |
validate_certs: false |
|
72 |
follow_redirects: yes |
|
73 |
register: cheresult |
|
74 |
retries: "{{ _retry }}" |
|
75 |
delay: "{{ _delay }}" |
|
76 |
until: cheresult.status == 200 |
|
77 |
|
|
78 |
- name: Wait for Keycloak route to respond with 200 |
|
79 |
uri: |
|
80 |
url: "http://{{ keycloak_route.stdout }}" |
|
81 |
method: GET |
|
82 |
validate_certs: false |
|
83 |
follow_redirects: yes |
|
84 |
register: keycloakresult |
|
85 |
retries: "{{ _retry }}" |
|
86 |
delay: "{{ _delay }}" |
|
87 |
until: keycloakresult.status == 200 |
|
88 |
|
|
89 |
- name: Get Keycloak username |
|
90 |
command: > |
|
91 |
oc get deployment/keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="SSO_ADMIN_USERNAME")].value'} -n "{{ _namespace }}" |
|
92 |
register: sso_admin_username |
|
93 |
|
|
94 |
- name: Get Keycloak password |
|
95 |
command: > |
|
96 |
oc get deployment/keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="SSO_ADMIN_PASSWORD")].value'} -n "{{ _namespace }}" |
|
97 |
register: sso_admin_password |