blob: f5fd6487c31a4169777e0f81d14415c4fe0bc5d0 (
plain)
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
|
---
# Fact setting
- name: Set default image variables based on deployment type
include_vars: "{{ item }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "default_images.yml"
- name: set ansible_service_broker facts
set_fact:
template_service_broker_prefix: "{{ template_service_broker_prefix | default(__template_service_broker_prefix) }}"
template_service_broker_version: "{{ template_service_broker_version | default(__template_service_broker_version) }}"
template_service_broker_image_name: "{{ template_service_broker_image_name | default(__template_service_broker_image_name) }}"
- oc_project:
name: openshift-template-service-broker
state: present
- command: mktemp -d /tmp/tsb-ansible-XXXXXX
register: mktemp
changed_when: False
become: no
- copy:
src: "{{ __tsb_files_location }}/{{ item }}"
dest: "{{ mktemp.stdout }}/{{ item }}"
with_items:
- "{{ __tsb_template_file }}"
- "{{ __tsb_rbac_file }}"
- "{{ __tsb_broker_file }}"
- name: Apply template file
shell: >
oc process -f "{{ mktemp.stdout }}/{{ __tsb_template_file }}" --param API_SERVER_CONFIG="{{ lookup('file', __tsb_files_location ~ '/' ~ __tsb_config_file) }}" --param IMAGE="{{ template_service_broker_prefix }}{{ template_service_broker_image_name }}:{{ template_service_broker_version }}" | kubectl apply -f -
# reconcile with rbac
- name: Reconcile with RBAC file
shell: >
oc process -f "{{ mktemp.stdout }}/{{ __tsb_rbac_file }}" | oc auth reconcile -f -
- name: copy tech preview extension file for service console UI
copy:
src: openshift-ansible-catalog-console.js
dest: /etc/origin/master/openshift-ansible-catalog-console.js
# Check that the TSB is running
- name: Verify that TSB is running
command: >
curl -k https://apiserver.openshift-template-service-broker.svc/healthz
args:
# Disables the following warning:
# Consider using get_url or uri module rather than running curl
warn: no
register: api_health
until: api_health.stdout == 'ok'
retries: 120
delay: 1
changed_when: false
- set_fact:
openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
when: openshift_master_config_dir is undefined
- slurp:
src: "{{ openshift_master_config_dir }}/ca.crt"
register: __ca_bundle
# Register with broker
- name: Register TSB with broker
shell: >
oc process -f "{{ mktemp.stdout }}/{{ __tsb_broker_file }}" --param CA_BUNDLE="{{ __ca_bundle.content }}" | oc apply -f -
- file:
state: absent
name: "{{ mktemp.stdout }}"
changed_when: False
become: no
|