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.

113 lines
3.8 KiB

9 years ago
8 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, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  51. - hosts: k8s-cluster:calico-rr
  52. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  53. roles:
  54. - { role: kubespray-defaults}
  55. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  56. - hosts: k8s-cluster
  57. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  58. roles:
  59. - { role: kubespray-defaults}
  60. - { role: kubernetes/node, tags: node }
  61. environment: "{{proxy_env}}"
  62. - hosts: kube-master
  63. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  64. roles:
  65. - { role: kubespray-defaults}
  66. - { role: kubernetes/master, tags: master }
  67. - { role: kubernetes/client, tags: client }
  68. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  69. - hosts: k8s-cluster
  70. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  71. roles:
  72. - { role: kubespray-defaults}
  73. - { role: kubernetes/kubeadm, tags: kubeadm}
  74. - { role: network_plugin, tags: network }
  75. - hosts: kube-master[0]
  76. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  77. roles:
  78. - { role: kubespray-defaults}
  79. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  80. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"]}
  81. - hosts: kube-master
  82. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  83. roles:
  84. - { role: kubespray-defaults}
  85. - { role: kubernetes-apps/network_plugin, tags: network }
  86. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  87. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  88. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  89. - hosts: calico-rr
  90. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  91. roles:
  92. - { role: kubespray-defaults}
  93. - { role: network_plugin/calico/rr, tags: network }
  94. - hosts: kube-master
  95. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  96. roles:
  97. - { role: kubespray-defaults}
  98. - { role: kubernetes-apps, tags: apps }
  99. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
  100. environment: "{{proxy_env}}"