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.

128 lines
4.1 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: bastion[0]
  16. gather_facts: False
  17. roles:
  18. - { role: kubespray-defaults}
  19. - { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
  20. - hosts: k8s-cluster:etcd:calico-rr
  21. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  22. gather_facts: false
  23. roles:
  24. - { role: kubespray-defaults}
  25. - { role: bootstrap-os, tags: bootstrap-os}
  26. - hosts: k8s-cluster:etcd:calico-rr
  27. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  28. vars:
  29. ansible_ssh_pipelining: true
  30. gather_facts: false
  31. pre_tasks:
  32. - name: gather facts from all instances
  33. setup:
  34. delegate_to: "{{ item }}"
  35. delegate_facts: true
  36. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  37. run_once: true
  38. - hosts: k8s-cluster:etcd:calico-rr
  39. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  40. roles:
  41. - { role: kubespray-defaults}
  42. - { role: kubernetes/preinstall, tags: preinstall }
  43. - { role: "container-engine", tags: "container-engine", when: deploy_container_engine|default(true) }
  44. - { role: download, tags: download, when: "not skip_downloads" }
  45. environment: "{{ proxy_env }}"
  46. - hosts: etcd
  47. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  48. roles:
  49. - { role: kubespray-defaults}
  50. - role: etcd
  51. tags: etcd
  52. vars:
  53. etcd_cluster_setup: true
  54. etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
  55. when: not etcd_kubeadm_enabled| default(false)
  56. - hosts: k8s-cluster:calico-rr
  57. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  58. roles:
  59. - { role: kubespray-defaults}
  60. - role: etcd
  61. tags: etcd
  62. vars:
  63. etcd_cluster_setup: false
  64. etcd_events_cluster_setup: false
  65. when: not etcd_kubeadm_enabled| default(false)
  66. - hosts: k8s-cluster
  67. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  68. roles:
  69. - { role: kubespray-defaults}
  70. - { role: kubernetes/node, tags: node }
  71. environment: "{{ proxy_env }}"
  72. - hosts: kube-master
  73. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  74. roles:
  75. - { role: kubespray-defaults}
  76. - { role: kubernetes/master, tags: master }
  77. - { role: kubernetes/client, tags: client }
  78. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  79. - hosts: k8s-cluster
  80. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  81. roles:
  82. - { role: kubespray-defaults}
  83. - { role: kubernetes/kubeadm, tags: kubeadm}
  84. - { role: network_plugin, tags: network }
  85. - hosts: kube-master[0]
  86. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  87. roles:
  88. - { role: kubespray-defaults}
  89. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  90. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"]}
  91. - hosts: kube-master
  92. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  93. roles:
  94. - { role: kubespray-defaults}
  95. - { role: kubernetes-apps/network_plugin, tags: network }
  96. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  97. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  98. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  99. - hosts: calico-rr
  100. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  101. roles:
  102. - { role: kubespray-defaults}
  103. - { role: network_plugin/calico/rr, tags: network }
  104. - hosts: kube-master
  105. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  106. roles:
  107. - { role: kubespray-defaults}
  108. - { role: kubernetes-apps, tags: apps }
  109. environment: "{{ proxy_env }}"
  110. - hosts: k8s-cluster
  111. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  112. roles:
  113. - { role: kubespray-defaults}
  114. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }