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.4 KiB

6 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. serial: "{{ serial | default('20%') }}"
  33. roles:
  34. - { role: kubespray-defaults}
  35. - { role: kubernetes/preinstall, tags: preinstall }
  36. - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) }
  37. - { role: download, tags: download, when: "not skip_downloads" }
  38. environment: "{{ proxy_env }}"
  39. - hosts: etcd
  40. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  41. roles:
  42. - { role: kubespray-defaults}
  43. - role: etcd
  44. tags: etcd
  45. vars:
  46. etcd_cluster_setup: true
  47. etcd_events_cluster_setup: false
  48. when: not etcd_kubeadm_enabled | default(false)
  49. - hosts: k8s-cluster
  50. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  51. roles:
  52. - { role: kubespray-defaults}
  53. - role: etcd
  54. tags: etcd
  55. vars:
  56. etcd_cluster_setup: false
  57. etcd_events_cluster_setup: false
  58. when: not etcd_kubeadm_enabled | default(false)
  59. - name: Handle upgrades to master components first to maintain backwards compat.
  60. hosts: kube-master
  61. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  62. serial: 1
  63. roles:
  64. - { role: kubespray-defaults}
  65. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  66. - { role: kubernetes/node, tags: node }
  67. - { role: kubernetes/master, tags: master, upgrade_cluster_setup: true }
  68. - { role: kubernetes/client, tags: client }
  69. - { role: kubernetes/node-label, tags: node-label }
  70. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  71. - { role: upgrade/post-upgrade, tags: post-upgrade }
  72. environment: "{{ proxy_env }}"
  73. - name: Upgrade calico on all masters and nodes
  74. hosts: kube-master:kube-node
  75. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  76. serial: "{{ serial | default('20%') }}"
  77. roles:
  78. - { role: kubespray-defaults}
  79. - { role: network_plugin, tags: network }
  80. - { role: kubernetes-apps/network_plugin, tags: network }
  81. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  82. - name: Finally handle worker upgrades, based on given batch size
  83. hosts: kube-node:!kube-master
  84. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  85. serial: "{{ serial | default('20%') }}"
  86. roles:
  87. - { role: kubespray-defaults}
  88. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  89. - { role: kubernetes/node, tags: node }
  90. - { role: kubernetes/kubeadm, tags: kubeadm }
  91. - { role: kubernetes/node-label, tags: node-label }
  92. - { role: upgrade/post-upgrade, tags: post-upgrade }
  93. environment: "{{ proxy_env }}"
  94. - hosts: kube-master[0]
  95. any_errors_fatal: true
  96. roles:
  97. - { role: kubespray-defaults}
  98. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  99. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"]}
  100. - hosts: calico-rr
  101. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  102. roles:
  103. - { role: kubespray-defaults}
  104. - { role: network_plugin/calico/rr, tags: network }
  105. environment: "{{ proxy_env }}"
  106. - hosts: kube-master
  107. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  108. roles:
  109. - { role: kubespray-defaults}
  110. - { role: kubernetes-apps, tags: apps }
  111. environment: "{{ proxy_env }}"
  112. - hosts: k8s-cluster
  113. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  114. roles:
  115. - { role: kubespray-defaults}
  116. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }