install.yml 5.4 KB

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