You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.6 KiB

9 years ago
9 years ago
9 years ago
  1. ---
  2. - hosts: localhost
  3. gather_facts: false
  4. become: no
  5. tasks:
  6. - name: "Check ansible version >=2.7.8"
  7. assert:
  8. msg: "Ansible must be v2.7.8 or higher"
  9. that:
  10. - ansible_version.string is version("2.7.8", ">=")
  11. tags:
  12. - check
  13. vars:
  14. ansible_connection: local
  15. - hosts: all
  16. gather_facts: false
  17. tasks:
  18. - name: "Set up proxy environment"
  19. set_fact:
  20. proxy_env:
  21. http_proxy: "{{ http_proxy | default ('') }}"
  22. HTTP_PROXY: "{{ http_proxy | default ('') }}"
  23. https_proxy: "{{ https_proxy | default ('') }}"
  24. HTTPS_PROXY: "{{ https_proxy | default ('') }}"
  25. no_proxy: "{{ no_proxy | default ('') }}"
  26. NO_PROXY: "{{ no_proxy | default ('') }}"
  27. no_log: true
  28. - hosts: bastion[0]
  29. gather_facts: False
  30. roles:
  31. - { role: kubespray-defaults }
  32. - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
  33. - hosts: k8s-cluster:etcd
  34. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  35. gather_facts: false
  36. roles:
  37. - { role: kubespray-defaults }
  38. - { role: bootstrap-os, tags: bootstrap-os}
  39. - name: Gather facts
  40. import_playbook: facts.yml
  41. - hosts: k8s-cluster:etcd
  42. gather_facts: False
  43. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  44. roles:
  45. - { role: kubespray-defaults }
  46. - { role: kubernetes/preinstall, tags: preinstall }
  47. - { role: "container-engine", tags: "container-engine", when: deploy_container_engine|default(true) }
  48. - { role: download, tags: download, when: "not skip_downloads" }
  49. environment: "{{ proxy_env }}"
  50. - hosts: etcd
  51. gather_facts: False
  52. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  53. roles:
  54. - { role: kubespray-defaults }
  55. - role: etcd
  56. tags: etcd
  57. vars:
  58. etcd_cluster_setup: true
  59. etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
  60. when: not etcd_kubeadm_enabled| default(false)
  61. - hosts: k8s-cluster
  62. gather_facts: False
  63. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  64. roles:
  65. - { role: kubespray-defaults }
  66. - role: etcd
  67. tags: etcd
  68. vars:
  69. etcd_cluster_setup: false
  70. etcd_events_cluster_setup: false
  71. when: not etcd_kubeadm_enabled| default(false)
  72. - hosts: k8s-cluster
  73. gather_facts: False
  74. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  75. roles:
  76. - { role: kubespray-defaults }
  77. - { role: kubernetes/node, tags: node }
  78. environment: "{{ proxy_env }}"
  79. - hosts: kube-master
  80. gather_facts: False
  81. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  82. roles:
  83. - { role: kubespray-defaults }
  84. - { role: kubernetes/master, tags: master }
  85. - { role: kubernetes/client, tags: client }
  86. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  87. - hosts: k8s-cluster
  88. gather_facts: False
  89. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  90. roles:
  91. - { role: kubespray-defaults }
  92. - { role: kubernetes/kubeadm, tags: kubeadm}
  93. - { role: network_plugin, tags: network }
  94. - { role: kubernetes/node-label, tags: node-label }
  95. - hosts: calico-rr
  96. gather_facts: False
  97. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  98. roles:
  99. - { role: kubespray-defaults }
  100. - { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] }
  101. - hosts: kube-master[0]
  102. gather_facts: False
  103. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  104. roles:
  105. - { role: kubespray-defaults }
  106. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  107. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
  108. - hosts: kube-master
  109. gather_facts: False
  110. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  111. roles:
  112. - { role: kubespray-defaults }
  113. - { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
  114. - { role: kubernetes-apps/network_plugin, tags: network }
  115. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  116. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  117. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  118. - hosts: kube-master
  119. gather_facts: False
  120. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  121. roles:
  122. - { role: kubespray-defaults }
  123. - { role: kubernetes-apps, tags: apps }
  124. environment: "{{ proxy_env }}"
  125. - hosts: k8s-cluster
  126. gather_facts: False
  127. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  128. roles:
  129. - { role: kubespray-defaults }
  130. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }