install.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. - name: Apply template file
  28. shell: >
  29. 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 -
  30. # reconcile with rbac
  31. - name: Reconcile with RBAC file
  32. shell: >
  33. oc process -f "{{ mktemp.stdout }}/{{ __tsb_rbac_file }}" | oc auth reconcile -f -
  34. - name: copy tech preview extension file for service console UI
  35. copy:
  36. src: openshift-ansible-catalog-console.js
  37. dest: /etc/origin/master/openshift-ansible-catalog-console.js
  38. # Check that the TSB is running
  39. - name: Verify that TSB is running
  40. command: >
  41. curl -k https://apiserver.openshift-template-service-broker.svc/healthz
  42. args:
  43. # Disables the following warning:
  44. # Consider using get_url or uri module rather than running curl
  45. warn: no
  46. register: api_health
  47. until: api_health.stdout == 'ok'
  48. retries: 120
  49. delay: 1
  50. changed_when: false
  51. - set_fact:
  52. openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
  53. when: openshift_master_config_dir is undefined
  54. - slurp:
  55. src: "{{ openshift_master_config_dir }}/ca.crt"
  56. register: __ca_bundle
  57. # Register with broker
  58. - name: Register TSB with broker
  59. shell: >
  60. oc process -f "{{ mktemp.stdout }}/{{ __tsb_broker_file }}" --param CA_BUNDLE="{{ __ca_bundle.content }}" | oc apply -f -
  61. - file:
  62. state: absent
  63. name: "{{ mktemp.stdout }}"
  64. changed_when: False
  65. become: no