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.

126 lines
4.6 KiB

6 years ago
  1. ---
  2. - hosts: bastion[0]
  3. gather_facts: False
  4. roles:
  5. - { role: kubespray-defaults}
  6. - { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
  7. - hosts: k8s-cluster:etcd:calico-rr
  8. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  9. gather_facts: false
  10. vars:
  11. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  12. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  13. ansible_ssh_pipelining: false
  14. roles:
  15. - { role: kubespray-defaults}
  16. - { role: bootstrap-os, tags: bootstrap-os}
  17. - hosts: k8s-cluster:etcd:calico-rr
  18. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  19. vars:
  20. ansible_ssh_pipelining: true
  21. gather_facts: true
  22. pre_tasks:
  23. - name: gather facts from all instances
  24. setup:
  25. delegate_to: "{{item}}"
  26. delegate_facts: True
  27. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  28. - hosts: k8s-cluster:etcd:calico-rr
  29. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  30. serial: "{{ serial | default('20%') }}"
  31. roles:
  32. - { role: kubespray-defaults}
  33. - { role: kubernetes/preinstall, tags: preinstall }
  34. - { role: container-engine, tags: "container-engine"}
  35. - { role: download, tags: download, when: "not skip_downloads" }
  36. environment: "{{proxy_env}}"
  37. - hosts: etcd:k8s-cluster:vault
  38. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  39. roles:
  40. - { role: kubespray-defaults, when: "cert_management == 'vault'" }
  41. - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
  42. environment: "{{proxy_env}}"
  43. - hosts: etcd
  44. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  45. roles:
  46. - { role: kubespray-defaults}
  47. - { role: etcd, tags: etcd, etcd_cluster_setup: true }
  48. - hosts: k8s-cluster
  49. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  50. roles:
  51. - { role: kubespray-defaults}
  52. - { role: etcd, tags: etcd, etcd_cluster_setup: false }
  53. - hosts: etcd:k8s-cluster:vault
  54. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  55. roles:
  56. - { role: kubespray-defaults, when: "cert_management == 'vault'"}
  57. - { role: vault, tags: vault, when: "cert_management == 'vault'"}
  58. environment: "{{proxy_env}}"
  59. #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 }
  68. - { role: kubernetes/client, tags: client }
  69. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  70. - { role: upgrade/post-upgrade, tags: post-upgrade }
  71. environment: "{{proxy_env}}"
  72. #Upgrade calico on all masters and nodes
  73. - hosts: kube-master:kube-node
  74. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  75. serial: "{{ serial | default('20%') }}"
  76. roles:
  77. - { role: kubespray-defaults}
  78. - { role: network_plugin, tags: network }
  79. - { role: kubernetes-apps/network_plugin, tags: network }
  80. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  81. #Finally handle worker upgrades, based on given batch size
  82. - hosts: kube-node:!kube-master
  83. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  84. serial: "{{ serial | default('20%') }}"
  85. roles:
  86. - { role: kubespray-defaults}
  87. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  88. - { role: kubernetes/node, tags: node }
  89. - { role: kubernetes/kubeadm, tags: kubeadm, when: "kubeadm_enabled" }
  90. - { role: upgrade/post-upgrade, tags: post-upgrade }
  91. environment: "{{proxy_env}}"
  92. - hosts: kube-master[0]
  93. any_errors_fatal: true
  94. roles:
  95. - { role: kubespray-defaults}
  96. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  97. - hosts: calico-rr
  98. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  99. roles:
  100. - { role: kubespray-defaults}
  101. - { role: network_plugin/calico/rr, tags: network }
  102. - hosts: k8s-cluster
  103. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  104. roles:
  105. - { role: kubespray-defaults}
  106. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  107. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }
  108. - hosts: kube-master
  109. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  110. roles:
  111. - { role: kubespray-defaults}
  112. - { role: kubernetes-apps, tags: apps }