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.

131 lines
4.3 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. - hosts: k8s-cluster:etcd
  40. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  41. roles:
  42. - { role: kubespray-defaults }
  43. - { role: kubernetes/preinstall, tags: preinstall }
  44. - { role: "container-engine", tags: "container-engine", when: deploy_container_engine|default(true) }
  45. - { role: download, tags: download, when: "not skip_downloads" }
  46. environment: "{{ proxy_env }}"
  47. - hosts: etcd
  48. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  49. roles:
  50. - { role: kubespray-defaults }
  51. - role: etcd
  52. tags: etcd
  53. vars:
  54. etcd_cluster_setup: true
  55. etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
  56. when: not etcd_kubeadm_enabled| default(false)
  57. - hosts: k8s-cluster
  58. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  59. roles:
  60. - { role: kubespray-defaults }
  61. - role: etcd
  62. tags: etcd
  63. vars:
  64. etcd_cluster_setup: false
  65. etcd_events_cluster_setup: false
  66. when: not etcd_kubeadm_enabled| default(false)
  67. - hosts: k8s-cluster
  68. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  69. roles:
  70. - { role: kubespray-defaults }
  71. - { role: kubernetes/node, tags: node }
  72. environment: "{{ proxy_env }}"
  73. - hosts: kube-master
  74. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  75. roles:
  76. - { role: kubespray-defaults }
  77. - { role: kubernetes/master, tags: master }
  78. - { role: kubernetes/client, tags: client }
  79. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  80. - hosts: k8s-cluster
  81. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  82. roles:
  83. - { role: kubespray-defaults }
  84. - { role: kubernetes/kubeadm, tags: kubeadm}
  85. - { role: network_plugin, tags: network }
  86. - { role: kubernetes/node-label, tags: node-label }
  87. - hosts: calico-rr
  88. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  89. roles:
  90. - { role: kubespray-defaults }
  91. - { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] }
  92. - hosts: kube-master[0]
  93. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  94. roles:
  95. - { role: kubespray-defaults }
  96. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  97. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
  98. - hosts: kube-master
  99. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  100. roles:
  101. - { role: kubespray-defaults }
  102. - { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
  103. - { role: kubernetes-apps/network_plugin, tags: network }
  104. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  105. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  106. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  107. - hosts: kube-master
  108. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  109. roles:
  110. - { role: kubespray-defaults }
  111. - { role: kubernetes-apps, tags: apps }
  112. environment: "{{ proxy_env }}"
  113. - hosts: k8s-cluster
  114. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  115. roles:
  116. - { role: kubespray-defaults }
  117. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }