install.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ---
  2. # Fact setting
  3. - name: Set default image variables based on openshift_deployment_type
  4. include_vars: "{{ item }}"
  5. with_first_found:
  6. - "{{ openshift_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. node_selector:
  17. - ""
  18. - command: mktemp -d /tmp/tsb-ansible-XXXXXX
  19. register: mktemp
  20. changed_when: False
  21. - copy:
  22. src: "{{ __tsb_files_location }}/{{ item }}"
  23. dest: "{{ mktemp.stdout }}/{{ item }}"
  24. with_items:
  25. - "{{ __tsb_template_file }}"
  26. - "{{ __tsb_rbac_file }}"
  27. - "{{ __tsb_broker_file }}"
  28. - "{{ __tsb_config_file }}"
  29. - yedit:
  30. src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
  31. key: templateNamespaces
  32. value: "{{ openshift_template_service_broker_namespaces }}"
  33. value_type: list
  34. - slurp:
  35. src: "{{ mktemp.stdout }}/{{ __tsb_config_file }}"
  36. register: config
  37. - name: Apply template file
  38. shell: >
  39. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __tsb_template_file }}"
  40. --param API_SERVER_CONFIG="{{ config['content'] | b64decode }}"
  41. --param IMAGE="{{ template_service_broker_prefix }}{{ template_service_broker_image_name }}:{{ template_service_broker_version }}"
  42. --param NODE_SELECTOR={{ template_service_broker_selector | to_json | quote }}
  43. | {{ openshift_client_binary }} apply -f -
  44. # reconcile with rbac
  45. - name: Reconcile with RBAC file
  46. shell: >
  47. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __tsb_rbac_file }}" | {{ openshift_client_binary }} auth reconcile -f -
  48. # Check that the TSB is running
  49. - name: Verify that TSB is running
  50. command: >
  51. curl -k https://apiserver.openshift-template-service-broker.svc/healthz
  52. args:
  53. # Disables the following warning:
  54. # Consider using get_url or uri module rather than running curl
  55. warn: no
  56. register: api_health
  57. until: api_health.stdout == 'ok'
  58. retries: 120
  59. delay: 1
  60. changed_when: false
  61. - set_fact:
  62. openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
  63. when: openshift_master_config_dir is undefined
  64. - slurp:
  65. src: "{{ openshift_master_config_dir }}/service-signer.crt"
  66. register: __ca_bundle
  67. # Register with broker
  68. - name: Register TSB with broker
  69. shell: >
  70. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ __tsb_broker_file }}" --param CA_BUNDLE="{{ __ca_bundle.content }}" | {{ openshift_client_binary }} apply -f -
  71. - file:
  72. state: absent
  73. name: "{{ mktemp.stdout }}"
  74. changed_when: False