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.

130 lines
4.7 KiB

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