install.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ---
  2. # Fact setting
  3. - name: Set default image variables based on deployment type
  4. include_vars: "{{ item }}"
  5. with_first_found:
  6. - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
  7. - "default_images.yml"
  8. - name: set ansible_service_broker facts
  9. set_fact:
  10. template_service_broker_prefix: "{{ template_service_broker_prefix | default(__template_service_broker_prefix) }}"
  11. template_service_broker_version: "{{ template_service_broker_version | default(__template_service_broker_version) }}"
  12. template_service_broker_image_name: "{{ template_service_broker_image_name | default(__template_service_broker_image_name) }}"
  13. - oc_project:
  14. name: openshift-template-service-broker
  15. state: present
  16. - command: mktemp -d /tmp/tsb-ansible-XXXXXX
  17. register: mktemp
  18. changed_when: False
  19. become: no
  20. - copy:
  21. src: "{{ __tsb_files_location }}/{{ item }}"
  22. dest: "{{ mktemp.stdout }}/{{ item }}"
  23. with_items:
  24. - "{{ __tsb_template_file }}"
  25. - "{{ __tsb_rbac_file }}"
  26. - "{{ __tsb_broker_file }}"
  27. - "{{ __tsb_config_file }}"
  28. - yedit:
  29. src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
  30. key: templateNamespaces
  31. value: "{{ openshift_template_service_broker_namespaces }}"
  32. value_type: list
  33. - slurp:
  34. src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
  35. register: config
  36. - name: Apply template file
  37. shell: >
  38. oc process -f "{{ mktemp.stdout }}/{{ __tsb_template_file }}"
  39. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  40. --param IMAGE="{{ template_service_broker_prefix }}{{ template_service_broker_image_name }}:{{ template_service_broker_version }}"
  41. | kubectl apply -f -
  42. # reconcile with rbac
  43. - name: Reconcile with RBAC file
  44. shell: >
  45. oc process -f "{{ mktemp.stdout }}/{{ __tsb_rbac_file }}" | oc auth reconcile -f -
  46. - name: copy tech preview extension file for service console UI
  47. copy:
  48. src: openshift-ansible-catalog-console.js
  49. dest: /etc/origin/master/openshift-ansible-catalog-console.js
  50. # Check that the TSB is running
  51. - name: Verify that TSB is running
  52. command: >
  53. curl -k https://apiserver.openshift-template-service-broker.svc/healthz
  54. args:
  55. # Disables the following warning:
  56. # Consider using get_url or uri module rather than running curl
  57. warn: no
  58. register: api_health
  59. until: api_health.stdout == 'ok'
  60. retries: 120
  61. delay: 1
  62. changed_when: false
  63. - set_fact:
  64. openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
  65. when: openshift_master_config_dir is undefined
  66. - slurp:
  67. src: "{{ openshift_master_config_dir }}/ca.crt"
  68. register: __ca_bundle
  69. # Register with broker
  70. - name: Register TSB with broker
  71. shell: >
  72. oc process -f "{{ mktemp.stdout }}/{{ __tsb_broker_file }}" --param CA_BUNDLE="{{ __ca_bundle.content }}" | oc apply -f -
  73. - file:
  74. state: absent
  75. name: "{{ mktemp.stdout }}"
  76. changed_when: False
  77. become: no