deploy_cluster_40.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. ---
  2. - name: run the init
  3. import_playbook: init/main.yml
  4. vars:
  5. l_init_fact_hosts: "nodes"
  6. l_openshift_version_set_hosts: "nodes"
  7. l_install_base_packages: True
  8. l_repo_hosts: "all:!all"
  9. # TODO(michaelgugino): break up the rest of this file into reusable chunks.
  10. - name: Install nodes
  11. hosts: nodes
  12. roles:
  13. - role: container_runtime
  14. tasks:
  15. - import_role:
  16. name: container_runtime
  17. tasks_from: docker_storage_setup_overlay.yml
  18. - import_role:
  19. name: container_runtime
  20. tasks_from: extra_storage_setup.yml
  21. - import_role:
  22. name: container_runtime
  23. tasks_from: package_crio.yml
  24. - import_role:
  25. name: openshift_node40
  26. tasks_from: install.yml
  27. - name: Config bootstrap node
  28. hosts: bootstrap
  29. tasks:
  30. - import_role:
  31. name: openshift_node40
  32. tasks_from: config.yml
  33. - import_role:
  34. name: openshift_node40
  35. tasks_from: systemd.yml
  36. vars:
  37. excluded_services:
  38. - progress.service
  39. - name: Start masters
  40. hosts: masters
  41. tasks:
  42. # This is required for openshift_node40/config.yml
  43. - set_fact:
  44. openshift_bootstrap_endpoint: "https://{{ openshift_master_cluster_hostname }}:{{ mcd_port }}/config/master"
  45. - name: Wait for bootstrap endpoint to show up
  46. uri:
  47. url: "{{ openshift_bootstrap_endpoint }}"
  48. validate_certs: false
  49. delay: 10
  50. retries: 60
  51. register: result
  52. until:
  53. - "'status' in result"
  54. - result.status == 200
  55. - import_role:
  56. name: openshift_node40
  57. tasks_from: config.yml
  58. - name: Make sure etcd user exists
  59. user:
  60. name: etcd
  61. - import_role:
  62. name: openshift_node40
  63. tasks_from: systemd.yml
  64. - name: Start workers
  65. hosts: workers
  66. tasks:
  67. # This is required for openshift_node40/config.yml
  68. - set_fact:
  69. openshift_bootstrap_endpoint: "https://{{ openshift_master_cluster_hostname }}:{{ mcd_port }}/config/worker"
  70. - name: Wait for bootstrap endpoint to show up
  71. uri:
  72. url: "{{ openshift_bootstrap_endpoint }}"
  73. validate_certs: false
  74. delay: 10
  75. retries: 60
  76. register: result
  77. until:
  78. - "'status' in result"
  79. - result.status == 200
  80. - import_role:
  81. name: openshift_node40
  82. tasks_from: config.yml
  83. - import_role:
  84. name: openshift_node40
  85. tasks_from: systemd.yml
  86. - name: Wait for nodes to become ready
  87. hosts: bootstrap
  88. tasks:
  89. - name: Wait for temporary control plane to show up
  90. oc_obj:
  91. state: list
  92. kind: pod
  93. namespace: kube-system
  94. kubeconfig: /opt/openshift/auth/kubeconfig
  95. register: control_plane_pods
  96. retries: 60
  97. delay: 10
  98. until:
  99. - "'results' in control_plane_pods and 'results' in control_plane_pods.results"
  100. - control_plane_pods.results.results[0]['items'] | length > 0
  101. - name: Wait for master nodes to show up
  102. oc_obj:
  103. state: list
  104. kind: node
  105. selector: "node-role.kubernetes.io/master"
  106. kubeconfig: /opt/openshift/auth/kubeconfig
  107. register: master_nodes
  108. retries: 60
  109. delay: 10
  110. until:
  111. - "'results' in master_nodes and 'results' in master_nodes.results"
  112. - master_nodes.results.results[0]['items'] | length > 0
  113. - name: Wait for bootkube service to finish
  114. service_facts: {}
  115. #10 mins to complete temp plane
  116. retries: 120
  117. delay: 5
  118. until: "'bootkube.service' not in ansible_facts.services"
  119. ignore_errors: true
  120. - name: Fetch kubeconfig for test container
  121. fetch:
  122. src: /opt/openshift/auth/kubeconfig
  123. dest: /tmp/artifacts/installer/auth/kubeconfig
  124. flat: yes
  125. - name: Wait for core operators to appear and complete
  126. oc_obj:
  127. state: list
  128. kind: ClusterOperator
  129. name: "{{ item }}"
  130. kubeconfig: /opt/openshift/auth/kubeconfig
  131. register: operator
  132. #Give each operator 5 mins to come up
  133. retries: 60
  134. delay: 5
  135. until:
  136. - "'results' in operator"
  137. - "'results' in operator.results"
  138. - operator.results.results | length > 0
  139. - "'status' in operator.results.results[0]"
  140. - "'conditions' in operator.results.results[0]['status']"
  141. - operator.results.results[0].status.conditions | selectattr('type', 'match', '^Available$') | map(attribute='status') | join | bool == True
  142. - operator.results.results[0].status.conditions | selectattr('type', 'match', '^Progressing$') | map(attribute='status') | join | bool == False
  143. - operator.results.results[0].status.conditions | selectattr('type', 'match', '^Failing$') | map(attribute='status') | join | bool == False
  144. with_items:
  145. - machine-config-operator
  146. # Fails often with 'x of y nodes are not at revision n'
  147. #- openshift-cluster-kube-apiserver-operator
  148. # Failing with 'ConfigObservationFailing: configmap/cluster-config-v1.kube-system: no recognized cloud provider platform found' - https://github.com/openshift/cluster-kube-controller-manager-operator/issues/100
  149. #- openshift-cluster-kube-controller-manager-operator
  150. # Fails often with 'x of y nodes are not at revision n'
  151. #- openshift-cluster-kube-scheduler-operator
  152. #- openshift-cluster-openshift-apiserver-operator
  153. - openshift-cluster-openshift-controller-manager-operator
  154. - openshift-ingress-operator
  155. ignore_errors: true
  156. - block:
  157. - name: Output the operators status
  158. oc_obj:
  159. state: list
  160. kind: ClusterOperator
  161. selector: ""
  162. kubeconfig: /opt/openshift/auth/kubeconfig
  163. - fail:
  164. msg: Required operators didn't complete the install
  165. when: operator.failed