Tok
2018-11-09 04259f14a042c84a1164402d9ac2009c9db6adf5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
 
- name: check if user is cluster admin
  shell: "oc get project default"
  register: default_project_result
  ignore_errors: true
  changed_when: false
 
- fail:
    msg: "User does not have cluster-admin rights to install Fuse Online"
  when: default_project_result is failed
 
 
- name: Create project for workload; project =  {{ocp_project}}
  shell: "oc new-project {{ocp_project}} --display-name={{ocp_project}}"
 
- name: "Label namespace"
  command: "oc label namespace {{ocp_project}} AAD='{{guid}}'"
 
- name: Make sure we go back do default project
  shell: "oc project default"
 
 
 
# ######                 Fuse Online            ##########
 
- name: Create serviceaccount-as-oauthclient
  shell: "oc create -f {{syndesisio_sa_yml}} -n {{ocp_project}}"
 
- name: Create syndesisio template; {{syndesisio_template_yml}}
  shell: "oc create -f {{syndesisio_template_yml}} -n {{ocp_project}}"
 
 
- name: delete temp dir if it exists
  file:
      path: /tmp/{{ocp_project}}
      state: absent
- file:
      path: /tmp/{{ocp_project}}
      state: directory
 
- name: Load fuse-ignite-is
  shell: "oc create -f {{ fuse_ignite_is_yaml }} -n {{ocp_project}}"
 
- name: Create the syndesisio app
  shell: |
      oc new-app {{ignite_template_name}} \
      -p ROUTE_HOSTNAME=fuse.{{ocp_project}}.{{ocp_apps_domain}} \
      -p OPENSHIFT_MASTER=https://master.{{ocp_domain}} \
      -p OPENSHIFT_PROJECT={{ocp_project}} \
      -p POSTGRESQL_MEMORY_LIMIT={{POSTGRESQL_MEMORY_LIMIT}} \
      -p PROMETHEUS_MEMORY_LIMIT={{PROMETHEUS_MEMORY_LIMIT}} \
      -p META_MEMORY_LIMIT={{META_MEMORY_LIMIT}} \
      -p SERVER_MEMORY_LIMIT={{SERVER_MEMORY_LIMIT}} \
      -p OPENSHIFT_OAUTH_CLIENT_SECRET=$(oc sa get-token syndesis-oauth-client -n {{ocp_project}}) \
      -p MAX_INTEGRATIONS_PER_USER={{MAX_INTEGRATIONS_PER_USER}} \
      -p IMAGE_STREAM_NAMESPACE={{ocp_project}} \
      -n {{ocp_project}}
 
- name: resume syndesis oauthproxy and db
  shell: oc rollout resume dc/syndesis-oauthproxy dc/syndesis-db -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - syndesis-oauthproxy
      - syndesis-db
 
- name: Scale up broker-amq
  shell: |
      oc scale dc/broker-amq --replicas=1 -n {{ocp_project}}
- name: resume broker-amq
  shell: oc rollout resume dc/broker-amq -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - "broker-amq"
 
- name: resume syndesis-meta
  shell: oc rollout resume dc/syndesis-meta -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - syndesis-meta
 
- name: resume syndesis-server
  shell: oc rollout resume dc/syndesis-server -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - syndesis-server
 
- name: resume syndesis-ui
  shell: oc rollout resume dc/syndesis-ui -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - syndesis-ui
 
- name: resume syndesis-prometheus
  shell: oc rollout resume dc/syndesis-prometheus -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - syndesis-prometheus
 
- name: resume todo
  shell: oc rollout resume dc/todo -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - todo
 
# ########################################################
 
 
 
# ######        Coolstore Catalog Service       ##########
 
- name: Add the view role to the default service account
  shell: "oc policy add-role-to-user view -z default -n {{ocp_project}}"
 
- name: Copy catalog service configmap to known path
  template:
    src: templates/app-config.yaml
    dest: /tmp/{{ocp_project}}/app-config.yaml
- name: Load catalog service configmap
  shell: "oc create configmap app-config --from-file=/tmp/{{ocp_project}}/app-config.yaml -n {{ocp_project}}"
 
 
- name: Copy catalog service (with db) template to known path
  template:
    src: templates/coolstore-catalog-mongodb-persistent.yaml
    dest: /tmp/{{ocp_project}}/coolstore-catalog-mongodb-persistent.yaml
- name: Build and create catalog service
  shell: |
      oc new-app \
      -f /tmp/{{ocp_project}}/coolstore-catalog-mongodb-persistent.yaml \
      -p CATALOG_DB_USERNAME=mongo \
      -p CATALOG_DB_PASSWORD=mongo \
      -n {{ocp_project}}
 
- include_tasks: ./wait_for_build.yml
  static: no
  vars:
    build_to_wait:
      - catalog-service-s2i
 
- name: resume catalog-service
  shell: oc rollout resume dc/catalog-service -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - catalog-service
 
# ########################################################
 
- name: Annotate the empty project as requested by user
  shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{ocp_username}} --overwrite"
 
- name: Give ocp_username access to ocp_project; user = {{ocp_username}}
  shell: "oc policy add-role-to-user admin {{ocp_username}} -n {{ocp_project}}"
 
 
- name: workload Tasks Complete
  debug:
    msg: workload Tasks Complete