install.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. ---
  2. # do any asserts here
  3. - name: Create temp directory for doing work in
  4. command: mktemp -d /tmp/openshift-service-catalog-ansible-XXXXXX
  5. register: mktemp
  6. changed_when: False
  7. - name: Set default image variables based on openshift_deployment_type
  8. include_vars: "{{ item }}"
  9. with_first_found:
  10. - "{{ openshift_deployment_type }}.yml"
  11. - "default_images.yml"
  12. - name: Set service_catalog image facts
  13. set_fact:
  14. openshift_service_catalog_image_prefix: "{{ openshift_service_catalog_image_prefix | default(__openshift_service_catalog_image_prefix) }}"
  15. openshift_service_catalog_image_version: "{{ openshift_service_catalog_image_version | default(__openshift_service_catalog_image_version) }}"
  16. - name: Set Service Catalog namespace
  17. oc_project:
  18. state: present
  19. name: "kube-service-catalog"
  20. node_selector: ""
  21. - when: os_sdn_network_plugin_name == 'redhat/openshift-ovs-multitenant'
  22. block:
  23. - name: Waiting for netnamespace kube-service-catalog to be ready
  24. oc_obj:
  25. kind: netnamespace
  26. name: kube-service-catalog
  27. state: list
  28. register: get_output
  29. until: not get_output.results.stderr is defined
  30. retries: 30
  31. delay: 1
  32. changed_when: false
  33. - name: Make kube-service-catalog project network global
  34. command: >
  35. {{ openshift_client_binary }} --config=/etc/origin/master/admin.kubeconfig adm pod-network make-projects-global kube-service-catalog
  36. - include_tasks: generate_certs.yml
  37. - copy:
  38. src: kubeservicecatalog_roles_bindings.yml
  39. dest: "{{ mktemp.stdout }}/kubeservicecatalog_roles_bindings.yml"
  40. - oc_obj:
  41. name: service-catalog-role-bindings
  42. kind: template
  43. namespace: "kube-service-catalog"
  44. files:
  45. - "{{ mktemp.stdout }}/kubeservicecatalog_roles_bindings.yml"
  46. - oc_process:
  47. create: True
  48. template_name: service-catalog-role-bindings
  49. namespace: "kube-service-catalog"
  50. - copy:
  51. src: kubesystem_roles_bindings.yml
  52. dest: "{{ mktemp.stdout }}/kubesystem_roles_bindings.yml"
  53. - oc_obj:
  54. name: kube-system-service-catalog-role-bindings
  55. kind: template
  56. namespace: kube-system
  57. files:
  58. - "{{ mktemp.stdout }}/kubesystem_roles_bindings.yml"
  59. - oc_process:
  60. create: True
  61. template_name: kube-system-service-catalog-role-bindings
  62. namespace: kube-system
  63. - copy:
  64. src: openshift_catalog_clusterroles.yml
  65. dest: "{{ mktemp.stdout }}/openshift_catalog_clusterroles.yml"
  66. - name: Apply Service Catalog cluster roles
  67. retries: 5
  68. delay: 2
  69. register: task_result
  70. until: task_result.rc == 0
  71. shell: >
  72. {{ openshift_client_binary }} auth reconcile --config={{ openshift.common.config_base }}/master/admin.kubeconfig -f {{ mktemp.stdout}}/openshift_catalog_clusterroles.yml
  73. - oc_adm_policy_user:
  74. namespace: kube-service-catalog
  75. resource_kind: scc
  76. resource_name: hostmount-anyuid
  77. state: present
  78. user: "system:serviceaccount:kube-service-catalog:service-catalog-apiserver"
  79. - name: Set SA cluster-role
  80. oc_adm_policy_user:
  81. state: present
  82. namespace: "kube-service-catalog"
  83. resource_kind: cluster-role
  84. resource_name: admin
  85. user: "system:serviceaccount:kube-service-catalog:default"
  86. - name: Checking for master.etcd-ca.crt
  87. stat:
  88. path: /etc/origin/master/master.etcd-ca.crt
  89. register: etcd_ca_crt
  90. check_mode: no
  91. ## api server
  92. - template:
  93. src: api_server.j2
  94. dest: "{{ mktemp.stdout }}/service_catalog_api_server.yml"
  95. vars:
  96. image: ""
  97. namespace: ""
  98. cpu_limit: none
  99. memory_limit: none
  100. cpu_requests: none
  101. memory_request: none
  102. cors_allowed_origin: localhost
  103. etcd_servers: "{{ openshift_master_etcd_urls | join(',') }}"
  104. etcd_cafile: "{{ '/etc/origin/master/master.etcd-ca.crt' if etcd_ca_crt.stat.exists else '/etc/origin/master/ca-bundle.crt' }}"
  105. node_selector: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) }}"
  106. # apiserver_ca is defined in generate_certs.yml
  107. ca_hash: "{{ apiserver_ca.content|hash('sha1') }}"
  108. - name: Set Service Catalog API Server daemonset
  109. oc_obj:
  110. state: present
  111. namespace: "kube-service-catalog"
  112. kind: daemonset
  113. name: apiserver
  114. files:
  115. - "{{ mktemp.stdout }}/service_catalog_api_server.yml"
  116. delete_after: yes
  117. - name: Set Service Catalog API Server service
  118. oc_service:
  119. name: apiserver
  120. namespace: kube-service-catalog
  121. state: present
  122. ports:
  123. - name: secure
  124. port: 443
  125. protocol: TCP
  126. targetPort: 6443
  127. selector:
  128. app: apiserver
  129. session_affinity: None
  130. - template:
  131. src: api_server_route.j2
  132. dest: "{{ mktemp.stdout }}/service_catalog_api_route.yml"
  133. - name: Set Service Catalog API Server route
  134. oc_obj:
  135. state: present
  136. namespace: "kube-service-catalog"
  137. kind: route
  138. name: apiserver
  139. files:
  140. - "{{ mktemp.stdout }}/service_catalog_api_route.yml"
  141. delete_after: yes
  142. ## controller manager
  143. - template:
  144. src: controller_manager.j2
  145. dest: "{{ mktemp.stdout }}/controller_manager.yml"
  146. vars:
  147. image: ""
  148. cpu_limit: none
  149. memory_limit: none
  150. node_selector: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) }}"
  151. - name: Set Controller Manager deployment
  152. oc_obj:
  153. state: present
  154. namespace: "kube-service-catalog"
  155. kind: daemonset
  156. name: controller-manager
  157. files:
  158. - "{{ mktemp.stdout }}/controller_manager.yml"
  159. delete_after: yes
  160. - include_tasks: start_api_server.yml
  161. - name: Delete temp directory
  162. file:
  163. name: "{{ mktemp.stdout }}"
  164. state: absent
  165. changed_when: False