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.

135 lines
4.9 KiB

9 years ago
9 years ago
9 years ago
  1. ---
  2. - hosts: localhost
  3. gather_facts: false
  4. tasks:
  5. - name: "Check ansible version !=2.7.0"
  6. assert:
  7. msg: "Ansible V2.7.0 can't be used until: https://github.com/ansible/ansible/issues/46600 is fixed"
  8. that:
  9. - ansible_version.string is version("2.7.0", "!=")
  10. - ansible_version.string is version("2.5.0", ">=")
  11. tags:
  12. - check
  13. vars:
  14. ansible_connection: local
  15. - hosts: localhost
  16. tasks:
  17. - name: deploy warning for non kubeadm
  18. debug:
  19. msg: "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
  20. when: not kubeadm_enabled and not skip_non_kubeadm_warning
  21. - name: deploy cluster for non kubeadm
  22. pause:
  23. prompt: "Are you sure you want to deploy cluster using the deprecated non-kubeadm mode."
  24. echo: no
  25. when: not kubeadm_enabled and not skip_non_kubeadm_warning
  26. - hosts: bastion[0]
  27. gather_facts: False
  28. roles:
  29. - { role: kubespray-defaults}
  30. - { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
  31. - hosts: k8s-cluster:etcd:calico-rr
  32. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  33. gather_facts: false
  34. vars:
  35. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  36. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  37. ansible_ssh_pipelining: false
  38. roles:
  39. - { role: kubespray-defaults}
  40. - { role: bootstrap-os, tags: bootstrap-os}
  41. - hosts: k8s-cluster:etcd:calico-rr
  42. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  43. vars:
  44. ansible_ssh_pipelining: true
  45. gather_facts: true
  46. pre_tasks:
  47. - name: gather facts from all instances
  48. setup:
  49. delegate_to: "{{item}}"
  50. delegate_facts: True
  51. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  52. - hosts: k8s-cluster:etcd:calico-rr
  53. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  54. roles:
  55. - { role: kubespray-defaults}
  56. - { role: kubernetes/preinstall, tags: preinstall }
  57. - { role: "container-engine", tags: "container-engine" }
  58. - { role: download, tags: download, when: "not skip_downloads" }
  59. environment: "{{proxy_env}}"
  60. - hosts: etcd
  61. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  62. roles:
  63. - { role: kubespray-defaults}
  64. - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  65. - hosts: k8s-cluster:calico-rr
  66. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  67. roles:
  68. - { role: kubespray-defaults}
  69. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  70. - hosts: k8s-cluster
  71. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  72. roles:
  73. - { role: kubespray-defaults}
  74. - { role: kubernetes/node, tags: node }
  75. environment: "{{proxy_env}}"
  76. - hosts: kube-master
  77. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  78. roles:
  79. - { role: kubespray-defaults}
  80. - { role: kubernetes/master, tags: master }
  81. - { role: kubernetes/client, tags: client }
  82. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  83. - hosts: k8s-cluster
  84. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  85. roles:
  86. - { role: kubespray-defaults}
  87. - { role: kubernetes/kubeadm, tags: kubeadm, when: "kubeadm_enabled" }
  88. - { role: network_plugin, tags: network }
  89. - hosts: kube-master[0]
  90. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  91. roles:
  92. - { role: kubespray-defaults}
  93. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  94. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"], when: "kubeadm_enabled" }
  95. - hosts: kube-master
  96. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  97. roles:
  98. - { role: kubespray-defaults}
  99. - { role: kubernetes-apps/network_plugin, tags: network }
  100. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  101. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  102. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  103. - hosts: calico-rr
  104. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  105. roles:
  106. - { role: kubespray-defaults}
  107. - { role: network_plugin/calico/rr, tags: network }
  108. - hosts: k8s-cluster
  109. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  110. roles:
  111. - { role: kubespray-defaults}
  112. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  113. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
  114. environment: "{{proxy_env}}"
  115. - hosts: kube-master
  116. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  117. roles:
  118. - { role: kubespray-defaults}
  119. - { role: kubernetes-apps, tags: apps }