install.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. - include: wire_aggregator.yml
  8. - name: Set default image variables based on deployment_type
  9. include_vars: "{{ item }}"
  10. with_first_found:
  11. - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
  12. - "default_images.yml"
  13. - name: Set service_catalog image facts
  14. set_fact:
  15. openshift_service_catalog_image_prefix: "{{ openshift_service_catalog_image_prefix | default(__openshift_service_catalog_image_prefix) }}"
  16. openshift_service_catalog_image_version: "{{ openshift_service_catalog_image_version | default(__openshift_service_catalog_image_version) }}"
  17. - name: Set Service Catalog namespace
  18. oc_project:
  19. state: present
  20. name: "kube-service-catalog"
  21. # node_selector: "{{ openshift_service_catalog_nodeselector | default(null) }}"
  22. - include: generate_certs.yml
  23. - copy:
  24. src: kubeservicecatalog_roles_bindings.yml
  25. dest: "{{ mktemp.stdout }}/kubeservicecatalog_roles_bindings.yml"
  26. - oc_obj:
  27. name: service-catalog
  28. kind: template
  29. namespace: "kube-service-catalog"
  30. files:
  31. - "{{ mktemp.stdout }}/kubeservicecatalog_roles_bindings.yml"
  32. delete_after: yes
  33. - oc_process:
  34. create: True
  35. template_name: service-catalog
  36. namespace: "kube-service-catalog"
  37. - copy:
  38. src: kubesystem_roles_bindings.yml
  39. dest: "{{ mktemp.stdout }}/kubesystem_roles_bindings.yml"
  40. - oc_obj:
  41. name: kube-system-service-catalog
  42. kind: template
  43. namespace: kube-system
  44. files:
  45. - "{{ mktemp.stdout }}/kubesystem_roles_bindings.yml"
  46. delete_after: yes
  47. - oc_process:
  48. create: True
  49. template_name: kube-system-service-catalog
  50. namespace: kube-system
  51. - shell: >
  52. oc get policybindings/kube-system:default -n kube-system || echo "not found"
  53. register: get_kube_system
  54. changed_when: no
  55. - command: >
  56. oc create policybinding kube-system -n kube-system
  57. when: "'not found' in get_kube_system.stdout"
  58. - oc_adm_policy_user:
  59. namespace: kube-service-catalog
  60. resource_kind: scc
  61. resource_name: hostmount-anyuid
  62. state: present
  63. user: "system:serviceaccount:kube-service-catalog:service-catalog-apiserver"
  64. - name: Set SA cluster-role
  65. oc_adm_policy_user:
  66. state: present
  67. namespace: "kube-service-catalog"
  68. resource_kind: cluster-role
  69. resource_name: admin
  70. user: "system:serviceaccount:kube-service-catalog:default"
  71. ## api server
  72. - template:
  73. src: api_server.j2
  74. dest: "{{ mktemp.stdout }}/service_catalog_api_server.yml"
  75. vars:
  76. image: ""
  77. namespace: ""
  78. cpu_limit: none
  79. memory_limit: none
  80. cpu_requests: none
  81. memory_request: none
  82. cors_allowed_origin: localhost
  83. node_selector: {"openshift-infra": "apiserver"}
  84. - name: Set Service Catalog API Server daemonset
  85. oc_obj:
  86. state: present
  87. namespace: "kube-service-catalog"
  88. kind: daemonset
  89. name: apiserver
  90. files:
  91. - "{{ mktemp.stdout }}/service_catalog_api_server.yml"
  92. delete_after: yes
  93. - template:
  94. src: api_server_service.j2
  95. dest: "{{ mktemp.stdout }}/service_catalog_api_service.yml"
  96. - name: Set Service Catalog API Server service
  97. oc_obj:
  98. state: present
  99. namespace: "kube-service-catalog"
  100. kind: service
  101. name: apiserver
  102. files:
  103. - "{{ mktemp.stdout }}/service_catalog_api_service.yml"
  104. delete_after: yes
  105. - template:
  106. src: api_server_route.j2
  107. dest: "{{ mktemp.stdout }}/service_catalog_api_route.yml"
  108. - name: Set Service Catalog API Server route
  109. oc_obj:
  110. state: present
  111. namespace: "kube-service-catalog"
  112. kind: route
  113. name: apiserver
  114. files:
  115. - "{{ mktemp.stdout }}/service_catalog_api_route.yml"
  116. delete_after: yes
  117. ## controller manager
  118. - template:
  119. src: controller_manager.j2
  120. dest: "{{ mktemp.stdout }}/controller_manager.yml"
  121. vars:
  122. image: ""
  123. node_selector: ""
  124. cpu_limit: none
  125. memory_limit: none
  126. node_selector: {"openshift-infra": "apiserver"}
  127. - name: Set Controller Manager deployment
  128. oc_obj:
  129. state: present
  130. namespace: "kube-service-catalog"
  131. kind: daemonset
  132. name: controller-manager
  133. files:
  134. - "{{ mktemp.stdout }}/controller_manager.yml"
  135. delete_after: yes
  136. - template:
  137. src: controller_manager_service.j2
  138. dest: "{{ mktemp.stdout }}/controller_manager_service.yml"
  139. - name: Set Controller Manager service
  140. oc_obj:
  141. state: present
  142. namespace: "kube-service-catalog"
  143. kind: service
  144. name: controller-manager
  145. files:
  146. - "{{ mktemp.stdout }}/controller_manager_service.yml"
  147. delete_after: yes
  148. - name: Delete temp directory
  149. file:
  150. name: "{{ mktemp.stdout }}"
  151. state: absent
  152. changed_when: False