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.

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