install.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # This playbook installs onto a provisioned cluster
  2. #TODO: split into parts: nodes.yml, bootstrap.yml, masters.yml, workers.yml, bootkube/post_setup.yml
  3. ---
  4. - hosts: localhost
  5. connection: local
  6. tasks:
  7. - name: place all scale groups into Ansible groups
  8. include_role:
  9. name: openshift_gcp
  10. tasks_from: setup_scale_group_facts.yml
  11. - name: run the init
  12. import_playbook: ../../playbooks/init/main.yml
  13. vars:
  14. l_init_fact_hosts: "bootstrap:masters:workers"
  15. l_openshift_version_set_hosts: "bootstrap:masters:workers"
  16. l_install_base_packages: True
  17. l_repo_hosts: "all:!all"
  18. - name: Install nodes
  19. hosts: bootstrap:masters:workers
  20. roles:
  21. - role: container_runtime
  22. tasks:
  23. - import_role:
  24. name: container_runtime
  25. tasks_from: docker_storage_setup_overlay.yml
  26. - import_role:
  27. name: container_runtime
  28. tasks_from: extra_storage_setup.yml
  29. - import_role:
  30. name: container_runtime
  31. tasks_from: package_crio.yml
  32. - name: FIXME pause_image
  33. ini_file:
  34. dest: "/etc/crio/crio.conf"
  35. section: crio.image
  36. option: pause_image
  37. value: '"docker.io/openshift/origin-pod:v4.0"'
  38. - name: FIXME restart crio
  39. service:
  40. name: crio
  41. state: restarted
  42. - import_role:
  43. name: openshift_node40
  44. tasks_from: install.yml
  45. - name: Config bootstrap node
  46. hosts: bootstrap
  47. tasks:
  48. - import_role:
  49. name: openshift_node40
  50. tasks_from: config.yml
  51. - import_role:
  52. name: openshift_node40
  53. tasks_from: systemd.yml
  54. vars:
  55. excluded_services:
  56. - progress.service
  57. - name: Start masters
  58. hosts: masters
  59. tasks:
  60. # This is required for openshift_node40/config.yml
  61. - set_fact:
  62. openshift_bootstrap_endpoint: "https://{{ openshift_master_cluster_hostname }}:{{ mcd_port }}/config/master"
  63. - name: Wait for bootstrap endpoint to show up
  64. uri:
  65. url: "{{ openshift_bootstrap_endpoint }}"
  66. validate_certs: false
  67. delay: 10
  68. retries: 60
  69. register: result
  70. until:
  71. - "'status' in result"
  72. - result.status == 200
  73. - import_role:
  74. name: openshift_node40
  75. tasks_from: config.yml
  76. - name: Make sure etcd user exists
  77. user:
  78. name: etcd
  79. - import_role:
  80. name: openshift_node40
  81. tasks_from: systemd.yml
  82. - name: Start workers
  83. hosts: workers
  84. tasks:
  85. # This is required for openshift_node40/config.yml
  86. - set_fact:
  87. openshift_bootstrap_endpoint: "https://{{ openshift_master_cluster_hostname }}:{{ mcd_port }}/config/worker"
  88. - name: Wait for bootstrap endpoint to show up
  89. uri:
  90. url: "{{ openshift_bootstrap_endpoint }}"
  91. validate_certs: false
  92. delay: 10
  93. retries: 60
  94. register: result
  95. until:
  96. - "'status' in result"
  97. - result.status == 200
  98. - import_role:
  99. name: openshift_node40
  100. tasks_from: config.yml
  101. - import_role:
  102. name: openshift_node40
  103. tasks_from: systemd.yml
  104. - name: Wait for nodes to become ready
  105. hosts: bootstrap
  106. tasks:
  107. - name: Wait for temporary control plane to show up
  108. #TODO: Rework with k8s module
  109. oc_obj:
  110. state: list
  111. kind: pod
  112. namespace: kube-system
  113. kubeconfig: /opt/tectonic/auth/kubeconfig
  114. register: control_plane_pods
  115. retries: 60
  116. delay: 10
  117. until:
  118. - "'results' in control_plane_pods and 'results' in control_plane_pods.results"
  119. - control_plane_pods.results.results[0]['items'] | length > 0
  120. - name: Wait for master nodes to show up
  121. #TODO: Rework with k8s module
  122. oc_obj:
  123. state: list
  124. kind: node
  125. selector: "node-role.kubernetes.io/master"
  126. kubeconfig: /opt/tectonic/auth/kubeconfig
  127. register: master_nodes
  128. retries: 60
  129. delay: 10
  130. until:
  131. - "'results' in master_nodes and 'results' in master_nodes.results"
  132. - master_nodes.results.results[0]['items'] | length > 0
  133. - name: Wait for bootkube service to finish
  134. service_facts: {}
  135. #10 mins to complete temp plane
  136. retries: 120
  137. delay: 5
  138. until: ansible_facts.services['bootkube.service'].state == 'stopped'
  139. ignore_errors: true