install.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 template_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. {{ openshift.common.client_binary }} 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. | {{ openshift.common.client_binary }} apply -f -
  42. # reconcile with rbac
  43. - name: Reconcile with RBAC file
  44. shell: >
  45. {{ openshift.common.client_binary }} process -f "{{ mktemp.stdout }}/{{ __tsb_rbac_file }}" | {{ openshift.common.client_binary }} auth reconcile -f -
  46. # Check that the TSB is running
  47. - name: Verify that TSB is running
  48. command: >
  49. curl -k https://apiserver.openshift-template-service-broker.svc/healthz
  50. args:
  51. # Disables the following warning:
  52. # Consider using get_url or uri module rather than running curl
  53. warn: no
  54. register: api_health
  55. until: api_health.stdout == 'ok'
  56. retries: 120
  57. delay: 1
  58. changed_when: false
  59. - set_fact:
  60. openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
  61. when: openshift_master_config_dir is undefined
  62. - slurp:
  63. src: "{{ openshift_master_config_dir }}/service-signer.crt"
  64. register: __ca_bundle
  65. # Register with broker
  66. - name: Register TSB with broker
  67. shell: >
  68. {{ openshift.common.client_binary }} process -f "{{ mktemp.stdout }}/{{ __tsb_broker_file }}" --param CA_BUNDLE="{{ __ca_bundle.content }}" | {{ openshift.common.client_binary }} apply -f -
  69. - file:
  70. state: absent
  71. name: "{{ mktemp.stdout }}"
  72. changed_when: False
  73. become: no