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.

117 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. vars:
  24. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  25. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  26. ansible_ssh_pipelining: false
  27. roles:
  28. - { role: kubespray-defaults}
  29. - { role: bootstrap-os, tags: bootstrap-os}
  30. - hosts: k8s-cluster:etcd:calico-rr
  31. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  32. vars:
  33. ansible_ssh_pipelining: true
  34. gather_facts: false
  35. pre_tasks:
  36. - name: gather facts from all instances
  37. setup:
  38. delegate_to: "{{item}}"
  39. delegate_facts: true
  40. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  41. run_once: true
  42. - hosts: k8s-cluster:etcd:calico-rr
  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. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  52. roles:
  53. - { role: kubespray-defaults}
  54. - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  55. - hosts: k8s-cluster:calico-rr
  56. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  57. roles:
  58. - { role: kubespray-defaults}
  59. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  60. - hosts: k8s-cluster
  61. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  62. roles:
  63. - { role: kubespray-defaults}
  64. - { role: kubernetes/node, tags: node }
  65. environment: "{{proxy_env}}"
  66. - hosts: kube-master
  67. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  68. roles:
  69. - { role: kubespray-defaults}
  70. - { role: kubernetes/master, tags: master }
  71. - { role: kubernetes/client, tags: client }
  72. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  73. - hosts: k8s-cluster
  74. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  75. roles:
  76. - { role: kubespray-defaults}
  77. - { role: kubernetes/kubeadm, tags: kubeadm}
  78. - { role: network_plugin, tags: network }
  79. - hosts: kube-master[0]
  80. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  81. roles:
  82. - { role: kubespray-defaults}
  83. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  84. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"]}
  85. - hosts: kube-master
  86. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  87. roles:
  88. - { role: kubespray-defaults}
  89. - { role: kubernetes-apps/network_plugin, tags: network }
  90. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  91. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  92. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  93. - hosts: calico-rr
  94. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  95. roles:
  96. - { role: kubespray-defaults}
  97. - { role: network_plugin/calico/rr, tags: network }
  98. - hosts: kube-master
  99. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  100. roles:
  101. - { role: kubespray-defaults}
  102. - { role: kubernetes-apps, tags: apps }
  103. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
  104. environment: "{{proxy_env}}"